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

Method _draw_all

lib/matplotlib/colorbar.py:542–592  ·  view source on GitHub ↗

Calculate any free parameters based on the current cmap and norm, and do all the drawing.

(self)

Source from the content-addressed store, hash-verified

540 self.stale = True
541
542 def _draw_all(self):
543 """
544 Calculate any free parameters based on the current cmap and norm,
545 and do all the drawing.
546 """
547 if self.orientation == 'vertical':
548 if mpl.rcParams['ytick.minor.visible']:
549 self.minorticks_on()
550 else:
551 if mpl.rcParams['xtick.minor.visible']:
552 self.minorticks_on()
553 self.long_axis.set(label_position=self.ticklocation,
554 ticks_position=self.ticklocation)
555 self._short_axis().set_ticks([])
556 self._short_axis().set_ticks([], minor=True)
557
558 # Set self._boundaries and self._values, including extensions.
559 # self._boundaries are the edges of each square of color, and
560 # self._values are the value to map into the norm to get the
561 # color:
562 self._process_values()
563 # Set self.vmin and self.vmax to first and last boundary, excluding
564 # extensions:
565 self.vmin, self.vmax = self._boundaries[self._inside][[0, -1]]
566 # Compute the X/Y mesh.
567 X, Y = self._mesh()
568 # draw the extend triangles, and shrink the inner Axes to accommodate.
569 # also adds the outline path to self.outline spine:
570 self._do_extends()
571 lower, upper = self.vmin, self.vmax
572 if self.long_axis.get_inverted():
573 # If the axis is inverted, we need to swap the vmin/vmax
574 lower, upper = upper, lower
575 if self.orientation == 'vertical':
576 self.ax.set_xlim(0, 1)
577 self.ax.set_ylim(lower, upper)
578 else:
579 self.ax.set_ylim(0, 1)
580 self.ax.set_xlim(lower, upper)
581
582 # set up the tick locators and formatters. A bit complicated because
583 # boundary norms + uniform spacing requires a manual locator.
584 self.update_ticks()
585
586 if self._filled:
587 ind = np.arange(len(self._values))
588 if self._extend_lower():
589 ind = ind[1:]
590 if self._extend_upper():
591 ind = ind[:-1]
592 self._add_solids(X, Y, self._values[ind, np.newaxis])
593
594 def _add_solids(self, X, Y, C):
595 """Draw the colors; optionally add separators."""

Callers 2

__init__Method · 0.95
update_normalMethod · 0.95

Calls 14

minorticks_onMethod · 0.95
_short_axisMethod · 0.95
_process_valuesMethod · 0.95
_meshMethod · 0.95
_do_extendsMethod · 0.95
update_ticksMethod · 0.95
_extend_lowerMethod · 0.95
_extend_upperMethod · 0.95
_add_solidsMethod · 0.95
get_invertedMethod · 0.80
setMethod · 0.45
set_ticksMethod · 0.45

Tested by

no test coverage detected