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

Method update_normal

lib/matplotlib/colorbar.py:505–540  ·  view source on GitHub ↗

Update solid patches, lines, etc. This is meant to be called when the norm of the image or contour plot to which this colorbar belongs changes. If the norm on the mappable is different than before, this resets the locator and formatter for the axis, so if t

(self, mappable=None)

Source from the content-addressed store, hash-verified

503 self.ax.cla()
504
505 def update_normal(self, mappable=None):
506 """
507 Update solid patches, lines, etc.
508
509 This is meant to be called when the norm of the image or contour plot
510 to which this colorbar belongs changes.
511
512 If the norm on the mappable is different than before, this resets the
513 locator and formatter for the axis, so if these have been customized,
514 they will need to be customized again. However, if the norm only
515 changes values of *vmin*, *vmax* or *cmap* then the old formatter
516 and locator will be preserved.
517 """
518 if mappable:
519 # The mappable keyword argument exists because
520 # ScalarMappable.changed() emits self.callbacks.process('changed', self)
521 # in contrast, ColorizingArtist (and Colorizer) does not use this keyword.
522 # [ColorizingArtist.changed() emits self.callbacks.process('changed')]
523 # Also, there is no test where self.mappable == mappable is not True
524 # and possibly no use case.
525 # Therefore, the mappable keyword can be deprecated if cm.ScalarMappable
526 # is removed.
527 self.mappable = mappable
528 _log.debug('colorbar update normal %r %r', self.mappable.norm, self.norm)
529 self.set_alpha(self.mappable.get_alpha())
530 self.cmap = self.mappable.cmap
531 if self.mappable.norm != self.norm:
532 self.norm = self.mappable.norm
533 self._reset_locator_formatter_scale()
534
535 self._draw_all()
536 if isinstance(self.mappable, contour.ContourSet):
537 CS = self.mappable
538 if not CS.filled:
539 self.add_lines(CS)
540 self.stale = True
541
542 def _draw_all(self):
543 """

Callers

nothing calls this directly

Calls 5

set_alphaMethod · 0.95
_draw_allMethod · 0.95
add_linesMethod · 0.95
get_alphaMethod · 0.45

Tested by

no test coverage detected