-
-
Notifications
You must be signed in to change notification settings - Fork 7.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 our terms of service and privacy 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?
Changes from 7 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
Jump to
Uh oh!
There was an error while loading. < 8000 a class="Link--inTextBlock" data-turbo="false" href="" aria-label="Please reload this page">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 |
---|---|---|
|
@@ -360,6 +360,12 @@ | |
raise ValueError(f'{s!r} does not look like a color arg') | ||
|
||
|
||
def validate_color_or_None(s): | ||
if s is None or cbook._str_equal(s, "None"): | ||
return None | ||
return validate_color(s) | ||
|
||
|
||
validate_colorlist = _listify_validator( | ||
validate_color, allow_stringlist=True, doc='return a list of colorspecs') | ||
|
||
|
@@ -514,6 +520,13 @@ | |
8000 | raise ValueError(f"linestyle {ls!r} is not a valid on-off ink sequence.") | |
|
||
|
||
def _validate_linestyle_or_None(ls): | ||
if ls is None or cbook._str_equal(ls, "None"): | ||
return None | ||
|
||
return _validate_linestyle(ls) | ||
|
||
|
||
validate_fillstyle = ValidateInStrings( | ||
'markers.fillstyle', ['full', 'left', 'right', 'bottom', 'top', 'none']) | ||
|
||
|
@@ -1237,6 +1250,36 @@ | |
"grid.linewidth": validate_float, # in points | ||
"grid.alpha": validate_float, | ||
|
||
"grid.major.color": validate_color_or_None, # grid color | ||
"grid.major.linestyle": _validate_linestyle_or_None, # solid | ||
"grid.major.linewidth": validate_float_or_None, # in points | ||
"grid.major.alpha": validate_float_or_None, | ||
|
||
"grid.minor.color": validate_color_or_None, # grid color | ||
"grid.minor.linestyle": _validate_linestyle_or_None, # solid | ||
"grid.minor.linewidth": validate_float_or_None, # in points | ||
"grid.minor.alpha": validate_float_or_None, | ||
|
||
"grid.xaxis.major.color": validate_color_or_None, # grid color | ||
"grid.xaxis.major.linestyle": _validate_linestyle_or_None, # solid | ||
"grid.xaxis.major.linewidth": validate_float_or_None, # in points | ||
"grid.xaxis.major.alpha": validate_float_or_None, | ||
|
||
"grid.xaxis.minor.color": validate_color_or_None, # grid color | ||
"grid.xaxis.minor.linestyle": _validate_linestyle_or_None, # solid | ||
"grid.xaxis.minor.linewidth": validate_float_or_None, # in points | ||
"grid.xaxis.minor.alpha": validate_float_or_None, | ||
|
||
"grid.yaxis.major.color": validate_color_or_None, # grid color | ||
"grid.yaxis.major.linestyle": _validate_linestyle_or_None, # solid | ||
"grid.yaxis.major.linewidth": validate_float_or_None, # in points | ||
"grid.yaxis.major.alpha": validate_float_or_None, | ||
|
||
"grid.yaxis.minor.color": validate_color_or_None, # grid color | ||
"grid.yaxis.minor.linestyle": _validate_linestyle_or_None, # solid | ||
"grid.yaxis.minor.linewidth": validate_float_or_None, # in points< 628C /td> | ||
"grid.yaxis.minor.alpha": validate_float_or_None, | ||
|
||
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. Seeing this in code, it feels a bit too much. I've browsed though a lot of plots and didn't find relevant usage. If the grids are different on x and y, it's typically that only one of them is activated. I've not seen the case that people use different styles for x and y. Therefore I revert my previous proposal and think we should leave this out (YAGNI). Sorry for the back-and-forth, but sometimes one has to go the step to see it was wrong. On the plus side, this interplay lead to the expansion of 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. That is far. I will revert the changes. It's simple anyway with the new |
||
## figure props | ||
# figure title | ||
"figure.titlesize": validate_fontsize, | ||
|
Uh oh!
There was an error while loading. Please reload this page.