Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1b6135

Browse files
committed
DOC: add docstring for set_array; improve related docstrings in _axes.py
1 parent ebfe81d commit f1b6135

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5522,8 +5522,9 @@ def pcolormesh(self, *args, **kwargs):
55225522
.. seealso::
55235523
55245524
:func:`~matplotlib.pyplot.pcolor`
5525-
For an explanation of the grid orientation and the
5526-
expansion of 1-D *X* and/or *Y* to 2-D arrays.
5525+
For an explanation of the grid orientation
5526+
(:ref:`Grid Orientation <axes-pcolor-grid-orientation>`)
5527+
and the expansion of 1-D *X* and/or *Y* to 2-D arrays.
55275528
"""
55285529
if not self._hold:
55295530
self.cla()
@@ -5637,10 +5638,10 @@ def pcolorfast(self, *args, **kwargs):
56375638
(*nr*-1, *nc*-1). All cells are rectangles of the same size.
56385639
This is the fastest version.
56395640
5640-
*x*, *y* are 1D arrays of length *nc* +1 and *nr* +1, respectively,
5641-
giving the x and y boundaries of the cells. Hence the cells are
5642-
rectangular but the grid may be nonuniform. The speed is
5643-
intermediate. (The grid is checked, and if found to be
5641+
*x*, *y* are monotonic 1D arrays of length *nc* +1 and *nr* +1,
5642+
respectively, giving the x and y boundaries of the cells. Hence
5643+
the cells are rectangular but the grid may be nonuniform. The
5644+
speed is intermediate. (The grid is checked, and if found to be
56445645
uniform the fast version is used.)
56455646
56465647
*X* and *Y* are 2D arrays with shape (*nr* +1, *nc* +1) that specify
@@ -5654,7 +5655,7 @@ def pcolorfast(self, *args, **kwargs):
56545655
56555656
Note that the column index corresponds to the x-coordinate,
56565657
and the row index corresponds to y; for details, see
5657-
the "Grid Orientation" section below.
5658+
:ref:`Grid Orientation <axes-pcolor-grid-orientation>`.
56585659
56595660
Optional keyword arguments:
56605661

lib/matplotlib/image.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,8 @@ def set_data(self, x, y, A):
839839
"""
840840
Set the grid for the pixel centers, and the pixel values.
841841
842-
*x* and *y* are 1-D ndarrays of lengths N and M, respectively,
843-
specifying pixel centers
842+
*x* and *y* are monotonic 1-D ndarrays of lengths N and M,
843+
respectively, specifying pixel centers
844844
845845
*A* is an (M,N) ndarray or masked array of values to be
846846
colormapped, or a (M,N,3) RGB array, or a (M,N,4) RGBA
@@ -959,6 +959,19 @@ def _check_unsampled_image(self, renderer):
959959
return False
960960

961961
def set_data(self, x, y, A):
962+
"""
963+
Set the grid for the rectangle boundaries, and the data values.
964+
965+
*x* and *y* are monotonic 1-D ndarrays of lengths N+1 and M+1,
966+
respectively, specifying rectangle boundaries. If None,
967+
they will be created as uniform arrays from 0 through N
968+
and 0 through M, respectively.
969+
970+
*A* is an (M,N) ndarray or masked array of values to be
971+
colormapped, or a (M,N,3) RGB array, or a (M,N,4) RGBA
972+
array.
973+
974+
"""
962975
A = cbook.safe_masked_invalid(A, copy=True)
963976
if x is None:
964977
x = np.arange(0, A.shape[1]+1, dtype=np.float64)

0 commit comments

Comments
 (0)