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

Method _get_tickdir

lib/mpl_toolkits/mplot3d/axis3d.py:361–403  ·  view source on GitHub ↗

Get the direction of the tick. Parameters ---------- position : str, optional : {'upper', 'lower', 'default'} The position of the axis. Returns ------- tickdir : int Index which indicates which coordinate the tick lin

(self, position)

Source from the content-addressed store, hash-verified

359 return edgep1s, edgep2s, position
360
361 def _get_tickdir(self, position):
362 """
363 Get the direction of the tick.
364
365 Parameters
366 ----------
367 position : str, optional : {'upper', 'lower', 'default'}
368 The position of the axis.
369
370 Returns
371 -------
372 tickdir : int
373 Index which indicates which coordinate the tick line will
374 align with.
375 """
376 _api.check_in_list(('upper', 'lower', 'default'), position=position)
377
378 # TODO: Move somewhere else where it's triggered less:
379 tickdirs_base = [v["tickdir"] for v in self._AXINFO.values()] # default
380 elev_mod = np.mod(self.axes.elev + 180, 360) - 180
381 azim_mod = np.mod(self.axes.azim, 360)
382 if position == 'upper':
383 if elev_mod >= 0:
384 tickdirs_base = [2, 2, 0]
385 else:
386 tickdirs_base = [1, 0, 0]
387 if 0 <= azim_mod < 180:
388 tickdirs_base[2] = 1
389 elif position == 'lower':
390 if elev_mod >= 0:
391 tickdirs_base = [1, 0, 1]
392 else:
393 tickdirs_base = [2, 2, 1]
394 if 0 <= azim_mod < 180:
395 tickdirs_base[2] = 0
396 info_i = [v["i"] for v in self._AXINFO.values()]
397
398 i = self._axinfo["i"]
399 vert_ax = self.axes._vertical_axis
400 j = vert_ax - 2
401 # default: tickdir = [[1, 2, 1], [2, 2, 0], [1, 0, 0]][vert_ax][i]
402 tickdir = np.roll(info_i, -j)[np.roll(tickdirs_base, j)][i]
403 return tickdir
404
405 def active_pane(self):
406 mins, maxs, tc, highs = self._get_coord_info()

Callers 2

_draw_ticksMethod · 0.95

Calls 1

valuesMethod · 0.80

Tested by 1