def __init__(self, canvas, axis, dataLoc, length, direction, tickMarkProps={}, labelProps={}): """ **Constructor** axis The Axis instance this tick is attached to. dataLoc The data coordinate that this tick will be located at. length The length of the tick mark. direction Whether the tick should be drawn to the inside or outside of the axis. Valid values are 'in', 'out', and 'both'. Defaults to 'in'. tickMarkProps Keyword arguments for the tick mark Line object. labelProps Keyword arguments for the label Text object. """ Parent.__init__(self) self._tickMark = Line(canvas, **tickMarkProps) self._label = Text(canvas, **labelProps) self._axis = axis self.addChild(self._tickMark) self.addChild(self._label) # Location where the tick should be placed, in data coords self._dataLocation = dataLoc self._length = 5 self.setLength(length) self._direction = 'in' self.setDirection(direction)
def __init__(self, canvas, axis, type_='major', length=5, width=1, direction='in', font=None, locator=None, labeler=None): """ **Constructor** axis The Axis instance these ticks are attached to. type | The type of Axis these ticks are attached to. This is used | to modify the number of ticks required if they are minor ticks. | Can be one of: | 'major' | 'minor' length The default length for each tick. width The default width for each tick. direction The direction of the tick relative to the axis. font The default font for each tick label. locator The default Locator for the ticks. labeler The default Labeleer for the ticks. """ Parent.__init__(self) # defaults self._tickMarkProps = { 'width': 1, 'aliased': True, } self._labelProps = {'horizontalalignment': 'center', 'verticalalignment': 'center', 'font': Font() } self._ticks = [] self._canvas = canvas self._axis = axis self._type = type_ self._length = 5 self._width = 1 self._direction = 'in' self._font = Font() self.setLength(length) self.setWidth(width) self.setDirection(direction) self.setFont(font) self._locator = LinearLocator() self._labeler = NullLabeler() self.setLocator(locator) self.setLabeler(labeler) self._visible = True # This class is not an Artist, so it doesn't have the visible property