Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Support individual styling of major and minor grid through rcParams#29481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
bffeb0a
87726b6
e3d22aa
536b52e
397a2ad
87339d8
09a7346
42e0054
39eef79
a4e6f44
9a2b2b2
c886330
cd3c260
456034c
ca5a443
b455d6b
2cb99fc
6552586
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Separate styling options for major/minor grid line in rcParams | ||
-------------------------------------------------------------- | ||
Using :rc:`grid.major.*` or :rc:`grid.minor.*` will overwrite the value in | ||
:rc:`grid.*` for the major and minor gridlines, respectively. | ||
.. plot:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The example is a bit heavy. This should be illustrative easy to grap. It should give an idea what you can do and how. It's not an exhaustive documentation of the feature. The rendered entry should fit on a (large) screen. Please boil down to one figure (you can have two Axes side by side if really needed) and take a subset of rcParams only. Typically, one figure should be enough. Select a few parameters. | ||
:include-source: true | ||
:alt: Modifying the gridlines using the new options `rcParams` | ||
import matplotlib as mpl | ||
import matplotlib.pyplot as plt | ||
# Set visibility for major and minor gridlines | ||
mpl.rcParams["axes.grid"] = True | ||
mpl.rcParams["ytick.minor.visible"] = True | ||
mpl.rcParams["xtick.minor.visible"] = True | ||
mpl.rcParams["axes.grid.which"] = "both" | ||
# Using old old values to set both major and minor properties | ||
mpl.rcParams["grid.color"] = "red" | ||
mpl.rcParams["grid.linewidth"] = 1 | ||
# Overwrite some values for major and minor separately | ||
mpl.rcParams["grid.major.color"] = "black" | ||
mpl.rcParams["grid.major.linewidth"] = 2 | ||
mpl.rcParams["grid.minor.linestyle"] = ":" | ||
mpl.rcParams["grid.minor.alpha"] = 0.6 | ||
plt.plot([0, 1], [0, 1]) | ||
plt.show() |