Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2433955

Browse files
committed
Merge branch 'v2.0.x'
2 parents f924f39 + cbb3dc8 commit 2433955

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
New rcParams
2+
------------
3+
4+
The parameters `xtick.top`, `xtick.bottom`, `ytick.left`
5+
and `ytick.right` were added to control where the ticks
6+
are drawn.

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,10 @@ def __init__(self, fig, rect,
543543
if self.yaxis is not None:
544544
self._ycid = self.yaxis.callbacks.connect('units finalize',
545545
self.relim)
546+
self.tick_params(top=rcParams['xtick.top'],
547+
bottom=rcParams['xtick.bottom'],
548+
left=rcParams['ytick.left'],
549+
right=rcParams['ytick.right'])
546550

547551
def __setstate__(self, state):
548552
self.__dict__ = state

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ axes3d.grid : True # display grid on 3d axes
214214

215215
### TICKS
216216
# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick
217+
218+
xtick.top : True # draw ticks on the top side
219+
xtick.bottom : True # draw ticks on the bottom side
217220
xtick.major.size : 4 # major tick size in points
218221
xtick.minor.size : 2 # minor tick size in points
219222
xtick.minor.visible : False
@@ -225,6 +228,8 @@ xtick.color : k # color of the tick labels
225228
xtick.labelsize : medium # fontsize of the tick labels
226229
xtick.direction : in # direction: in, out, or inout
227230

231+
ytick.left : True # draw ticks on the left side
232+
ytick.right : True # draw ticks on the right side
228233
ytick.major.size : 4 # major tick size in points
229234
ytick.minor.size : 2 # minor tick size in points
230235
ytick.minor.visible : False
@@ -418,7 +423,7 @@ pdf.use14corefonts : False
418423
pgf.debug : False
419424
pgf.texsystem : xelatex
420425
pgf.rcfonts : True
421-
pgf.preamble :
426+
pgf.preamble :
422427

423428
# svg backend params
424429
svg.image_inline : True # write raster image data directly into the svg file

lib/matplotlib/rcsetup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,9 @@ def validate_cycler(s):
10171017
'legend.facecolor': ['inherit', validate_color_or_inherit],
10181018
'legend.edgecolor': ['inherit', validate_color_or_inherit],
10191019

1020-
## tick properties
1020+
# tick properties
1021+
'xtick.top': [True, validate_bool], # draw ticks on the top side
1022+
'xtick.bottom': [True, validate_bool], # draw ticks on the bottom side
10211023
'xtick.major.size': [4, validate_float], # major xtick size in points
10221024
'xtick.minor.size': [2, validate_float], # minor xtick size in points
10231025
'xtick.major.width': [0.5, validate_float], # major xtick width in points
@@ -1031,6 +1033,8 @@ def validate_cycler(s):
10311033
'xtick.labelsize': ['medium', validate_fontsize],
10321034
'xtick.direction': ['in', six.text_type], # direction of xticks
10331035

1036+
'ytick.left': [True, validate_bool], # draw ticks on the left side
1037+
'ytick.right': [True, validate_bool], # draw ticks on the right side
10341038
'ytick.major.size': [4, validate_float], # major ytick size in points
10351039
'ytick.minor.size': [2, validate_float], # minor ytick size in points
10361040
'ytick.major.width': [0.5, validate_float], # major ytick width in points

lib/matplotlib/tests/test_axes.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4024,6 +4024,23 @@ def test_rc_grid():
40244024
i += 1
40254025

40264026

4027+
@cleanup
4028+
def test_rc_tick():
4029+
d = {'xtick.bottom': False, 'xtick.top': True,
4030+
'ytick.left': True, 'ytick.right': False}
4031+
with plt.rc_context(rc=d):
4032+
fig = plt.figure()
4033+
ax1 = fig.add_subplot(1, 1, 1)
4034+
xax = ax1.xaxis
4035+
yax = ax1.yaxis
4036+
# tick1On bottom/left
4037+
assert xax._major_tick_kw['tick1On'] == False
4038+
assert xax._major_tick_kw['tick2On'] == True
4039+
4040+
assert yax._major_tick_kw['tick1On'] == True
4041+
assert yax._major_tick_kw['tick2On'] == False
4042+
4043+
40274044
@cleanup
40284045
def test_bar_negative_width():
40294046
fig, ax = plt.subplots()

matplotlibrc.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ backend : %(backend)s
281281

282282
### TICKS
283283
# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick
284+
285+
#xtick.top : True # draw ticks on the top side
286+
#xtick.bottom : True # draw ticks on the bottom side
284287
#xtick.major.size : 4 # major tick size in points
285288
#xtick.minor.size : 2 # minor tick size in points
286289
#xtick.major.width : 0.5 # major tick width in points
@@ -291,6 +294,9 @@ backend : %(backend)s
291294
#xtick.labelsize : medium # fontsize of the tick labels
292295
#xtick.direction : in # direction: in, out, or inout
293296

297+
298+
#ytick.left : True # draw ticks on the left side
299+
#ytick.right : True # draw ticks on the right side
294300
#ytick.major.size : 4 # major tick size in points
295301
#ytick.minor.size : 2 # minor tick size in points
296302
#ytick.major.width : 0.5 # major tick width in points

0 commit comments

Comments
 (0)