Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b9aedb8

Browse filesBrowse files
authored
Merge pull request #6735 from bcongdon/feature_rcParam_side_tick
ENH: Added missing side tick rcParams
2 parents 6d339ed + 1bf99bb commit b9aedb8
Copy full SHA for b9aedb8

File tree

Expand file treeCollapse file tree

6 files changed

+67
-6
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+67
-6
lines changed

‎doc/users/whats_new/ticks_rcparams.rst

Copy file name to clipboardExpand all lines: doc/users/whats_new/ticks_rcparams.rst
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The parameters ``xtick.top``, ``xtick.bottom``, ``ytick.left``
55
and ``ytick.right`` were added to control where the ticks
66
are drawn.
77

8+
Furthermore, the parameters ``xtick.major.top``, ``xtick.major.bottom``,
9+
``xtick.minor.top``, ``xtick.minor.bottom``, ``ytick.major.left``,
10+
``ytick.major.right``, ``ytick.minor.left``, and ``ytick.minor.right`` were
11+
added to control were ticks are drawn.
12+
813
``hist.bins`` to control the default number of bins to use in
914
`~matplotlib.axes.Axes.hist`. This can be an `int`, a list of floats, or
1015
``'auto'`` if numpy >= 1.11 is installed.

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+14-5Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,20 @@ def __init__(self, fig, rect,
566566
if self.yaxis is not None:
567567
self._ycid = self.yaxis.callbacks.connect('units finalize',
568568
self.relim)
569-
self.tick_params(top=rcParams['xtick.top'],
570-
bottom=rcParams['xtick.bottom'],
571-
left=rcParams['ytick.left'],
572-
right=rcParams['ytick.right'],
573-
which='both')
569+
570+
self.tick_params(
571+
top=rcParams['xtick.top'] and rcParams['xtick.minor.top'],
572+
bottom=rcParams['xtick.bottom'] and rcParams['xtick.minor.bottom'],
573+
left=rcParams['ytick.left'] and rcParams['ytick.minor.left'],
574+
right=rcParams['ytick.right'] and rcParams['ytick.minor.right'],
575+
which='minor')
576+
577+
self.tick_params(
578+
top=rcParams['xtick.top'] and rcParams['xtick.major.top'],
579+
bottom=rcParams['xtick.bottom'] and rcParams['xtick.major.bottom'],
580+
left=rcParams['ytick.left'] and rcParams['ytick.major.left'],
581+
right=rcParams['ytick.right'] and rcParams['ytick.major.right'],
582+
which='major')
574583

575584
def __setstate__(self, state):
576585
self.__dict__ = state

‎lib/matplotlib/mpl-data/stylelib/classic.mplstyle

Copy file name to clipboardExpand all lines: lib/matplotlib/mpl-data/stylelib/classic.mplstyle
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ xtick.minor.pad : 4 # distance to the minor tick label in points
243243
xtick.color : k # color of the tick labels
244244
xtick.labelsize : medium # fontsize of the tick labels
245245
xtick.direction : in # direction: in, out, or inout
246+
xtick.major.top : True # draw x axis top major ticks
247+
xtick.major.bottom : True # draw x axis bottom major ticks
248+
xtick.minor.top : True # draw x axis top minor ticks
249+
xtick.minor.bottom : True # draw x axis bottom minor ticks
246250

247251
ytick.left : True # draw ticks on the left side
248252
ytick.right : True # draw ticks on the right side
@@ -256,7 +260,10 @@ ytick.minor.pad : 4 # distance to the minor tick label in points
256260
ytick.color : k # color of the tick labels
257261
ytick.labelsize : medium # fontsize of the tick labels
258262
ytick.direction : in # direction: in, out, or inout
259-
263+
ytick.major.left : True # draw y axis left major ticks
264+
ytick.major.right : True # draw y axis right major ticks
265+
ytick.minor.left : True # draw y axis left minor ticks
266+
ytick.minor.right : True # draw y axis right minor ticks
260267

261268
### GRIDS
262269
grid.color : k # grid color

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,10 @@ def validate_animation_writer_path(p):
11741174
'xtick.minor.pad': [3.4, validate_float], # distance to label in points
11751175
'xtick.color': ['k', validate_color], # color of the xtick labels
11761176
'xtick.minor.visible': [False, validate_bool], # visiablility of the x axis minor ticks
1177+
'xtick.minor.top': [True, validate_bool], # draw x axis top minor ticks
1178+
'xtick.minor.bottom': [True, validate_bool], # draw x axis bottom minor ticks
1179+
'xtick.major.top': [True, validate_bool], # draw x axis top major ticks
1180+
'xtick.major.bottom': [True, validate_bool], # draw x axis bottom major ticks
11771181

11781182
# fontsize of the xtick labels
11791183
'xtick.labelsize': ['medium', validate_fontsize],
@@ -1189,6 +1193,10 @@ def validate_animation_writer_path(p):
11891193
'ytick.minor.pad': [3.4, validate_float], # distance to label in points
11901194
'ytick.color': ['k', validate_color], # color of the ytick labels
11911195
'ytick.minor.visible': [False, validate_bool], # visiablility of the y axis minor ticks
1196+
'ytick.minor.left': [True, validate_bool], # draw y axis left minor ticks
1197+
'ytick.minor.right': [True, validate_bool], # draw y axis right minor ticks
1198+
'ytick.major.left': [True, validate_bool], # draw y axis left major ticks
1199+
'ytick.major.right': [True, validate_bool], # draw y axis right major ticks
11921200

11931201
# fontsize of the ytick labels
11941202
'ytick.labelsize': ['medium', validate_fontsize],

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4130,6 +4130,30 @@ def test_rc_tick():
41304130
assert yax._minor_tick_kw['tick2On'] == False
41314131

41324132

4133+
@cleanup
4134+
def test_rc_major_minor_tick():
4135+
d = {'xtick.top': True, 'ytick.right': True, # Enable all ticks
4136+
'xtick.bottom': True, 'ytick.left': True,
4137+
# Selectively disable
4138+
'xtick.minor.bottom': False, 'xtick.major.bottom': False,
4139+
'ytick.major.left': False, 'ytick.minor.left': False}
4140+
with plt.rc_context(rc=d):
4141+
fig = plt.figure()
4142+
ax1 = fig.add_subplot(1, 1, 1)
4143+
xax = ax1.xaxis
4144+
yax = ax1.yaxis
4145+
# tick1On bottom/left
4146+
assert xax._major_tick_kw['tick1On'] == False
4147+
assert xax._major_tick_kw['tick2On'] == True
4148+
assert xax._minor_tick_kw['tick1On'] == False
4149+
assert xax._minor_tick_kw['tick2On'] == True
4150+
4151+
assert yax._major_tick_kw['tick1On'] == False
4152+
assert yax._major_tick_kw['tick2On'] == True
4153+
assert yax._minor_tick_kw['tick1On'] == False
4154+
assert yax._minor_tick_kw['tick2On'] == True
4155+
4156+
41334157
@cleanup
41344158
def test_bar_negative_width():
41354159
fig, ax = plt.subplots()

‎matplotlibrc.template

Copy file name to clipboardExpand all lines: matplotlibrc.template
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ backend : $TEMPLATE_BACKEND
373373
#xtick.labelsize : medium # fontsize of the tick labels
374374
#xtick.direction : out # direction: in, out, or inout
375375
#xtick.minor.visible : False # visibility of minor ticks on x-axis
376+
#xtick.major.top : True # draw x axis top major ticks
377+
#xtick.major.bottom : True # draw x axis bottom major ticks
378+
#xtick.minor.top : True # draw x axis top minor ticks
379+
#xtick.minor.bottom : True # draw x axis bottom minor ticks
376380

377381
#ytick.left : True # draw ticks on the left side
378382
#ytick.right : False # draw ticks on the right side
@@ -386,6 +390,10 @@ backend : $TEMPLATE_BACKEND
386390
#ytick.labelsize : medium # fontsize of the tick labels
387391
#ytick.direction : out # direction: in, out, or inout
388392
#ytick.minor.visible : False # visibility of minor ticks on y-axis
393+
#xtick.major.left : True # draw y axis left major ticks
394+
#xtick.major.right : True # draw y axis right major ticks
395+
#xtick.minor.left : True # draw y axis left minor ticks
396+
#xtick.minor.right : True # draw y axis right minor ticks
389397

390398

391399
### GRIDS

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.