Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bffeb0a
Possible fix for issue #13919
konmenel Jan 17, 2025
87726b6
fix flake warnings
konmenel Jan 18, 2025
e3d22aa
Resolve suggested changes
konmenel Jan 27, 2025
536b52e
Add new validators in stub file
konmenel Jan 27, 2025
397a2ad
make stub file arguments same as runtime
konmenel Jan 27, 2025
87339d8
Add distinction for x and y axis in grid line options
konmenel Jan 28, 2025
09a7346
fix flake8
konmenel Jan 28, 2025
42e0054
Add What's New note
konmenel Jan 28, 2025
39eef79
Extend `_val_or_rc` to support multiply names
konmenel Jan 28, 2025
a4e6f44
Fix linting for and _validate_linestyle_or_None to mypy allowlist
konmenel Jan 28, 2025
9a2b2b2
Remove validate linestyle functions from stubtest allow list
konmenel Jan 28, 2025
c886330
Revert change to just grid.major/minor distinction in rcParams
konmenel Jan 29, 2025
cd3c260
Update What's New note and reduced example
konmenel Jan 29, 2025
456034c
Add testing for `grid.major/minor.*` in rcParams
konmenel Jan 29, 2025
ca5a443
fix indentation and linting
konmenel Jan 29, 2025
b455d6b
Fix example description
konmenel Jan 29, 2025
2cb99fc
Fix spelling
konmenel Jan 29, 2025
6552586
Merge branch 'main' into fix-issue-13919
timhoffm Jan 31, 2025
830b8a0
Fix type
konmenel Jun 9, 2025
5b623a3
Fix formatting
konmenel Jun 9, 2025
6db787a
`validate_color_or_None` private and fix argument names
konmenel Jun 9, 2025
a6db063
Fix validator name in stub file as well
konmenel Jun 9, 2025
c14aa8a
correct validators for grid.*.color keys
konmenel Jun 9, 2025
1ae82eb
Revert change in mypy-stubtest-allowlist.txt
konmenel Jun 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add What's New note
  • Loading branch information
konmenel committed Jan 28, 2025
commit 42e0054c72b032c8327caefddd4eb6044d7e4aa9
80 changes: 80 additions & 0 deletions doc/users/next_whats_new/new_rcparams_grid_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Seperate styling options for major/minor and x/y axis 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. Similarly,
specifying :rc:`grid.xaxis.major.*` and :rc:`grid.yaxis.major.*` will overwrite
`grid.major.*` for x and y axis major gridlines respectively.
Comment thread
konmenel marked this conversation as resolved.
Outdated

.. plot::
Comment thread
konmenel marked this conversation as resolved.
:include-source: true
:alt: Modifying the gridlines for three figures using the new options `rcParams`

import matplotlib as mpl
import matplotlib.pyplot as plt

# Using old values
mpl.rcdefaults()
mpl.rcParams["axes.grid"] = True
mpl.rcParams["ytick.minor.visible"] = True
mpl.rcParams["xtick.minor.visible"] = True
mpl.rcParams["axes.grid.which"] = "both"
mpl.rcParams["grid.color"] = "red"
mpl.rcParams["grid.linewidth"] = 1
mpl.rcParams["grid.linestyle"] = "-"
mpl.rcParams["grid.alpha"] = 1
plt.figure()
plt.plot([0, 1], [0, 1])
plt.title("Runtime both set implicitly")

# Overwriting major and minor settings
mpl.rcdefaults()
mpl.rcParams["axes.grid"] = True
mpl.rcParams["ytick.minor.visible"] = True
mpl.rcParams["xtick.minor.visible"] = True
mpl.rcParams["axes.grid.which"] = "both"
mpl.rcParams["grid.color"] = "red"
mpl.rcParams["grid.linewidth"] = 1
mpl.rcParams["grid.linestyle"] = "-"
mpl.rcParams["grid.alpha"] = 1

mpl.rcParams["grid.major.color"] = "black"
mpl.rcParams["grid.major.linewidth"] = 2
mpl.rcParams["grid.major.linestyle"] = ":"
mpl.rcParams["grid.minor.color"] = "gray"
mpl.rcParams["grid.minor.linewidth"] = 0.5
mpl.rcParams["grid.minor.linestyle"] = "--"
mpl.rcParams["grid.minor.alpha"] = 0.5
plt.figure()
plt.plot([0, 1], [0, 1])
plt.title("Runtime explicitly set major and minor")

# Overwriting x and y axis for majro and minor lines
mpl.rcdefaults()
mpl.rcParams["axes.grid"] = True
mpl.rcParams["ytick.minor.visible"] = True
mpl.rcParams["xtick.minor.visible"] = True
mpl.rcParams["axes.grid.which"] = "both"
mpl.rcParams["grid.color"] = "red"
mpl.rcParams["grid.linewidth"] = 1
mpl.rcParams["grid.linestyle"] = "-"
mpl.rcParams["grid.alpha"] = 1

mpl.rcParams["grid.major.color"] = "black"
mpl.rcParams["grid.major.linewidth"] = 2
mpl.rcParams["grid.major.linestyle"] = ":"
mpl.rcParams["grid.minor.color"] = "gray"
mpl.rcParams["grid.minor.linewidth"] = 0.5
mpl.rcParams["grid.minor.linestyle"] = "--"
mpl.rcParams["grid.minor.alpha"] = 0.5

mpl.rcParams["grid.xaxis.major.color"] = "red"
mpl.rcParams["grid.xaxis.major.linewidth"] = 5
mpl.rcParams["grid.xaxis.major.alpha"] = 0.2
mpl.rcParams["grid.yaxis.minor.linestyle"] = "-"
mpl.rcParams["grid.yaxis.major.linewidth"] = 3
plt.figure()
plt.plot([0, 1], [0, 1])
plt.title("Runtime explicitly set some values for x and y axis")

plt.show()