-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTickLabels.py
35 lines (27 loc) · 950 Bytes
/
TickLabels.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from LabelProperties import LabelProperties
class TickLabels(object):
def __init__(self):
self._formatter = None
self.labels = None
self.labelPoints = None
self._properties = LabelProperties()
self.size = None
@property
def properties(self):
return self._properties
@property
def formatter(self):
return self._formatter
@formatter.setter
def formatter(self, func):
self._formatter = pylab.FuncFormatter(func)
def draw(self, axes, axis):
if self.labelPoints is not None:
axis.set_ticks(self.labelPoints)
if self.labels is not None:
axis.set_ticklabels(self.labels, **self.properties)
if self.formatter is not None:
axis.set_major_formatter(self.formatter)
if self.size is not None:
for tick in axis.get_majorticklabels():
tick.set_fontsize(self.size)