8000 Add a Whats_new entry, and augment docstrings · matplotlib/matplotlib@ee35e58 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee35e58

Browse files
committed
Add a Whats_new entry, and augment docstrings
1 parent 0100cec commit ee35e58

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
`Axes.tick_params` can set gridline properties
2+
----------------------------------------------
3+
4+
`Tick` objects hold gridlines as well as the tick mark and its label.
5+
`Axis.set_tick_params`, `Axes.tick_params` and `pyplot.tick_params`
6+
now have keyword arguments 'grid_color', 'grid_alpha', 'grid_linewidth',
7+
and 'grid_linestyle' for overriding the defaults in `rcParams`:
8+
'grid.color', etc.

lib/matplotlib/axes/_base.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,7 @@ def locator_params(self, axis='both', tight=None, **kwargs):
27902790
self.autoscale_view(tight=tight, scalex=_x, scaley=_y)
27912791

27922792
def tick_params(self, axis='both', **kwargs):
2793-
"""Change the appearance of ticks and tick labels.
2793+
"""Change the appearance of ticks, tick labels, and gridlines.
27942794
27952795
Parameters
27962796
----------
@@ -2848,16 +2848,29 @@ def tick_params(self, axis='both', **kwargs):
28482848
labelrotation : float
28492849
Tick label rotation
28502850
2851+
grid_color : color
2852+
Changes the gridline color to the given mpl color spec.
2853+
2854+
grid_alpha : float
2855+
Transparency of gridlines: 0 (transparent) to 1 (opaque).
2856+
2857+
grid_linewidth : float
2858+
Width of gridlines in points.
2859+
2860+
grid_linestyle : string
2861+
Any valid :class:`~matplotlib.lines.Line2D` line style spec.
2862+
28512863
Examples
28522864
--------
28532865
28542866
Usage ::
28552867
2856-
ax.tick_params(direction='out', length=6, width=2, colors='r')
2868+
ax.tick_params(direction='out', length=6, width=2, colors='r',
2869+
grid_color='r', grid_alpha=0.5)
28572870
28582871
This will make all major ticks be red, pointing out of the box,
28592872
and with dimensions 6 points by 2 points. Tick labels will
2860-
also be red.
2873+
also be red. Gridlines will be red and translucent.
28612874
28622875
"""
28632876
if axis in ['x', 'both']:

lib/matplotlib/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def reset_ticks(self):
813813

814814
def set_tick_params(self, which='major', reset=False, **kw):
815815
"""
816-
Set appearance parameters for ticks and ticklabels.
816+
Set appearance parameters for ticks, ticklabels, and gridlines.
817817
818818
For documentation of keyword arguments, see
819819
:meth:`matplotlib.axes.Axes.tick_params`.

0 commit comments

Comments
 (0)
0