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

Method _mesh

lib/matplotlib/colorbar.py:1132–1160  ·  view source on GitHub ↗

Return the coordinate arrays for the colorbar pcolormesh/patches. These are scaled between vmin and vmax, and already handle colorbar orientation.

(self)

Source from the content-addressed store, hash-verified

1130 self._values = (self._values + 0.00001).astype(np.int16)
1131
1132 def _mesh(self):
1133 """
1134 Return the coordinate arrays for the colorbar pcolormesh/patches.
1135
1136 These are scaled between vmin and vmax, and already handle colorbar
1137 orientation.
1138 """
1139 y, _ = self._proportional_y()
1140 # Use the vmin and vmax of the colorbar, which may not be the same
1141 # as the norm. There are situations where the colormap has a
1142 # narrower range than the colorbar and we want to accommodate the
1143 # extra contours.
1144 if (isinstance(self.norm, (colors.BoundaryNorm, colors.NoNorm))
1145 or self.boundaries is not None):
1146 # not using a norm.
1147 y = y * (self.vmax - self.vmin) + self.vmin
1148 else:
1149 # Update the norm values in a context manager as it is only
1150 # a temporary change and we don't want to propagate any signals
1151 # attached to the norm (callbacks.blocked).
1152 with (self.norm.callbacks.blocked(),
1153 cbook._setattr_cm(self.norm, vmin=self.vmin, vmax=self.vmax)):
1154 y = self.norm.inverse(y)
1155 self._y = y
1156 X, Y = np.meshgrid([0., 1.], y)
1157 if self.orientation == 'vertical':
1158 return (X, Y)
1159 else:
1160 return (Y, X)
1161
1162 def _forward_boundaries(self, x):
1163 # map boundaries equally between 0 and 1...

Callers 1

_draw_allMethod · 0.95

Calls 3

_proportional_yMethod · 0.95
blockedMethod · 0.80
inverseMethod · 0.45

Tested by

no test coverage detected