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

Method set_data

lib/matplotlib/image.py:1292–1328  ·  view source on GitHub ↗

Set the grid for the rectangle boundaries, and the data values. Parameters ---------- x, y : 1D array-like, optional Monotonic arrays of length N+1 and M+1, respectively, specifying rectangle boundaries. If not given, will default to

(self, x, y, A)

Source from the content-addressed store, hash-verified

1290 return False
1291
1292 def set_data(self, x, y, A):
1293 """
1294 Set the grid for the rectangle boundaries, and the data values.
1295
1296 Parameters
1297 ----------
1298 x, y : 1D array-like, optional
1299 Monotonic arrays of length N+1 and M+1, respectively, specifying
1300 rectangle boundaries. If not given, will default to
1301 ``range(N + 1)`` and ``range(M + 1)``, respectively.
1302 A : array-like
1303 The data to be color-coded. The interpretation depends on the
1304 shape:
1305
1306 - (M, N) `~numpy.ndarray` or masked array: values to be colormapped
1307 - (M, N, 3): RGB array
1308 - (M, N, 4): RGBA array
1309 """
1310 A = self._normalize_image_array(A)
1311 x = np.arange(0., A.shape[1] + 1) if x is None else np.array(x, float).ravel()
1312 y = np.arange(0., A.shape[0] + 1) if y is None else np.array(y, float).ravel()
1313 if A.shape[:2] != (y.size - 1, x.size - 1):
1314 raise ValueError(
1315 "Axes don't match array shape. Got %s, expected %s." %
1316 (A.shape[:2], (y.size - 1, x.size - 1)))
1317 # For efficient cursor readout, ensure x and y are increasing.
1318 if x[-1] < x[0]:
1319 x = x[::-1]
1320 A = A[:, ::-1]
1321 if y[-1] < y[0]:
1322 y = y[::-1]
1323 A = A[::-1]
1324 self._A = A
1325 self._Ax = x
1326 self._Ay = y
1327 self._imcache = None
1328 self.stale = True
1329
1330 def set_array(self, *args):
1331 raise NotImplementedError('Method not supported')

Callers 1

__init__Method · 0.95

Calls 1

Tested by

no test coverage detected