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

Method _draw_ticks

lib/mpl_toolkits/mplot3d/axis3d.py:437–483  ·  view source on GitHub ↗
(self, renderer, edgep1, centers, deltas, highs,
                    deltas_per_point, pos)

Source from the content-addressed store, hash-verified

435 return axmask
436
437 def _draw_ticks(self, renderer, edgep1, centers, deltas, highs,
438 deltas_per_point, pos):
439 ticks = self._update_ticks()
440 info = self._axinfo
441 index = info["i"]
442 juggled = info["juggled"]
443
444 mins, maxs, tc, highs = self._get_coord_info()
445 centers, deltas = self._calc_centers_deltas(maxs, mins)
446
447 # Get the scale transform for this axis to transform tick locations
448 axis = [self.axes.xaxis, self.axes.yaxis, self.axes.zaxis][index]
449 axis_trans = axis.get_transform()
450
451 # Draw ticks:
452 tickdir = self._get_tickdir(pos)
453 tickdelta = deltas[tickdir] if highs[tickdir] else -deltas[tickdir]
454
455 tick_info = info['tick']
456 tick_out = tick_info['outward_factor'] * tickdelta
457 tick_in = tick_info['inward_factor'] * tickdelta
458 tick_lw = tick_info['linewidth']
459 edgep1_tickdir = edgep1[tickdir]
460 out_tickdir = edgep1_tickdir + tick_out
461 in_tickdir = edgep1_tickdir - tick_in
462
463 default_label_offset = 8. # A rough estimate
464 points = deltas_per_point * deltas
465 # All coordinates below are in transformed coordinates for proper projection
466 for tick in ticks:
467 # Get tick line positions
468 pos = edgep1.copy()
469 pos[index] = axis_trans.transform([tick.get_loc()])[0]
470 pos[tickdir] = out_tickdir
471 x1, y1, z1 = proj3d.proj_transform(*pos, self.axes.M)
472 pos[tickdir] = in_tickdir
473 x2, y2, z2 = proj3d.proj_transform(*pos, self.axes.M)
474
475 # Get position of label
476 labeldeltas = (tick.get_pad() + default_label_offset) * points
477 pos[tickdir] = edgep1_tickdir
478 pos = _move_from_center(pos, centers, labeldeltas, self._axmask())
479 lx, ly, lz = proj3d.proj_transform(*pos, self.axes.M)
480
481 _tick_update_position(tick, (x1, x2), (y1, y2), (lx, ly))
482 tick.tick1line.set_linewidth(tick_lw[tick._major])
483 tick.draw(renderer)
484
485 def _draw_offset_text(self, renderer, edgep1, edgep2, labeldeltas, centers,
486 highs, pep, dx, dy):

Callers 1

drawMethod · 0.95

Calls 14

_update_ticksMethod · 0.95
_get_coord_infoMethod · 0.95
_calc_centers_deltasMethod · 0.95
_get_tickdirMethod · 0.95
_axmaskMethod · 0.95
_move_from_centerFunction · 0.85
_tick_update_positionFunction · 0.85
get_locMethod · 0.80
get_transformMethod · 0.45
copyMethod · 0.45
transformMethod · 0.45
get_padMethod · 0.45

Tested by

no test coverage detected