8000 Merge pull request #5290 from pizzathief/issue5277 · matplotlib/matplotlib@8379d78 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8379d78

Browse files
committed
Merge pull request #5290 from pizzathief/issue5277
implemeted get_ticks_direction()
2 parents 5e58e90 + 84c404d commit 8379d78

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2015-10-21 Added get_ticks_direction()
2+
13
2015-02-27 Added the rcParam 'image.composite_image' to permit users
24
to decide whether they want the vector graphics backends to combine
35
all images within a set of axes into a single composite image.

lib/matplotlib/axis.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,28 @@ def get_ticklocs(self, minor=False):
12441244
return self.minor.locator()
12451245
return self.major.locator()
12461246

1247+
def get_ticks_direction(self, minor=False):
1248+
"""
1249+
Get the tick directions as a numpy array
1250+
1251+
Parameters
1252+
----------
1253+
minor : boolean
1254+
True to return the minor tick directions,
1255+
False to return the major tick directions,
1256+
Default is False
1257+
1258+
Returns
1259+
-------
1260+
numpy array of tick directions
1261+
"""
1262+
if minor:
1263+
return np.array(
1264+
[tick._tickdir for tick in self.get_minor_ticks()])
1265+
else:
1266+
return np.array(
1267+
[tick._tickdir for tick in self.get_major_ticks()])
1268+
12471269
def _get_tick(self, major):
12481270
'return the default tick instance'
12491271
raise NotImplementedError('derived must override')

0 commit comments

Comments
 (0)
0