8000 Added test · matplotlib/matplotlib@17a615e · GitHub
[go: up one dir, main page]

Skip to content

Commit 17a615e

Browse files
committed
Added test
1 parent 20200a5 commit 17a615e

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

lib/matplotlib/axis.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,9 @@ def set_ticks_position(self, position):
19381938
self.stale = True
19391939

19401940
def tick_top(self):
1941-
'use ticks only on top'
1941+
"""
1942+
Move ticks and ticklabels (if present) to the top of the axes.
1943+
"""
19421944
label = True
19431945
if 'label1On' in self._major_tick_kw:
19441946
label = (self._major_tick_kw['label1On']
@@ -1949,7 +1951,9 @@ def tick_top(self):
19491951
self.set_tick_params(which='both', labeltop=label)
19501952

19511953
def tick_bottom(self):
1952-
'use ticks only on bottom'
1954+
"""
1955+
Move ticks and ticklabels (if present) to the bottom of the axes.
1956+
"""
19531957
label = True
19541958
if 'label1On' in self._major_tick_kw:
19551959
label = (self._major_tick_kw['label1On']
@@ -2288,7 +2292,9 @@ def set_ticks_position(self, position):
22882292
self.stale = True
22892293

22902294
def tick_right(self):
2291-
'use ticks only on right'
2295+
"""
2296+
Move ticks and ticklabels (if present) to the right of the axes.
2297+
"""
22922298
label = True
22932299
if 'label1On' in self._major_tick_kw:
22942300
label = (self._major_tick_kw['label1On']
@@ -2299,7 +2305,9 @@ def tick_right(self):
22992305
self.set_tick_params(which='both', labelright=label)
23002306

23012307
def tick_left(self):
2302-
'use ticks only on left'
2308+
"""
2309+
Move ticks and ticklabels (if present) to the left of the axes.
2310+
"""
23032311
label = True
23042312
if 'label1On' in self._major_tick_kw:
23052313
label = (self._major_tick_kw['label1On']

Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ def test_shared():
101101
check_visible(axs, [False, False, True, True], [True, False, True, False])
102102

103103

104+
def test_shared_and_moved():
105+
# test if sharey is on, but then tick_left is called that labels don't
106+
# re-appear. Seaborn does this just to be sure yaxis is on left...
107+
f, (a1, a2) = plt.subplots(1, 2, sharey=True)
108+
check_visible([a2], [True], [False])
109+
a2.yaxis.tick_left()
110+
check_visible([a2], [True], [False])
111+
112+
f, (a1, a2) = plt.subplots(2, 1, sharex=True)
113+
check_visible([a1], [False], [True])
114+
a2.xaxis.tick_bottom()
115+
check_visible([a1], [False], [True])
116+
117+
104118
def test_exceptions():
105119
# TODO should this test more options?
106120
with pytest.raises(ValueError):