MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / Ticks

Class Ticks

lib/mpl_toolkits/axisartist/axis_artist.py:107–224  ·  view source on GitHub ↗

Ticks are derived from `.Line2D`, and note that ticks themselves are markers. Thus, you should use set_mec, set_mew, etc. To change the tick size (length), use `set_ticksize`. To change the direction of the ticks, use ``set_tick_direction("in")`` (or "out", or "inout").

Source from the content-addressed store, hash-verified

105
106
107class Ticks(AttributeCopier, Line2D):
108 """
109 Ticks are derived from `.Line2D`, and note that ticks themselves
110 are markers. Thus, you should use set_mec, set_mew, etc.
111
112 To change the tick size (length), use `set_ticksize`.
113 To change the direction of the ticks, use ``set_tick_direction("in")`` (or
114 "out", or "inout").
115 """
116
117 locs_angles_labels = _api.deprecated("3.11")(property(lambda self: []))
118
119 @_api.delete_parameter("3.11", "tick_out", alternative="tick_direction")
120 def __init__(self, ticksize, tick_out=False, *, axis=None, **kwargs):
121 self._ticksize = ticksize
122 self.set_tick_out(tick_out)
123
124 self._axis = axis
125 if self._axis is not None:
126 if "color" not in kwargs:
127 kwargs["color"] = "auto"
128 if "mew" not in kwargs and "markeredgewidth" not in kwargs:
129 kwargs["markeredgewidth"] = "auto"
130
131 Line2D.__init__(self, [0.], [0.], **kwargs)
132 self.set_snap(True)
133
134 def get_ref_artist(self):
135 # docstring inherited
136 return self._axis.majorTicks[0].tick1line
137
138 def set_color(self, color):
139 # docstring inherited
140 # Unlike the base Line2D.set_color, this also supports "auto".
141 if not cbook._str_equal(color, "auto"):
142 mcolors._check_color_like(color=color)
143 self._color = color
144 self.stale = True
145
146 def get_color(self):
147 return self.get_attribute_from_ref_artist("color")
148
149 def get_markeredgecolor(self):
150 return self.get_attribute_from_ref_artist("markeredgecolor")
151
152 def get_markeredgewidth(self):
153 return self.get_attribute_from_ref_artist("markeredgewidth")
154
155 def set_tick_direction(self, direction):
156 _api.check_in_list(["in", "out", "inout"], direction=direction)
157 self._tick_dir = direction
158
159 def get_tick_direction(self):
160 return self._tick_dir
161
162 def set_tick_out(self, b):
163 """
164 Set whether ticks are drawn inside or outside the axes.

Callers 3

test_ticksFunction · 0.90
test_ticklabelsFunction · 0.90
_init_ticksMethod · 0.85

Calls 1

PathClass · 0.90

Tested by 2

test_ticksFunction · 0.72
test_ticklabelsFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…