Skip to content

Commit 00a4dab

Browse files
timhoffmstory645tacaswell
committed
Consistently use 3D, 2D, 1D for dimensionality
Co-authored-by: hannah <story645@gmail.com> Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
1 parent 7ee15a6 commit 00a4dab

File tree

26 files changed

+64
-64
lines changed

26 files changed

+64
-64
lines changed

examples/images_contours_and_fields/image_transparency_blend.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""
2-
===========================================
3-
Blend transparency with color in 2-D images
4-
===========================================
2+
==========================================
3+
Blend transparency with color in 2D images
4+
==========================================
55
66
Blend transparency with color to highlight parts of data with imshow.
77
8-
A common use for `matplotlib.pyplot.imshow` is to plot a 2-D statistical
9-
map. The function makes it easy to visualize a 2-D matrix as an image and add
8+
A common use for `matplotlib.pyplot.imshow` is to plot a 2D statistical
9+
map. The function makes it easy to visualize a 2D matrix as an image and add
1010
transparency to the output. For example, one can plot a statistic (such as a
1111
t-statistic) and color the transparency of each pixel according to its p-value.
1212
This example demonstrates how you can achieve this effect.
1313
14-
First we will generate some data, in this case, we'll create two 2-D "blobs"
15-
in a 2-D grid. One blob will be positive, and the other negative.
14+
First we will generate some data, in this case, we'll create two 2D "blobs"
15+
in a 2D grid. One blob will be positive, and the other negative.
1616
"""
1717

1818
# sphinx_gallery_thumbnail_number = 3

examples/images_contours_and_fields/pcolor_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Generating images with `~.axes.Axes.pcolor`.
77
8-
Pcolor allows you to generate 2-D image-style plots. Below we will show how
8+
Pcolor allows you to generate 2D image-style plots. Below we will show how
99
to do so in Matplotlib.
1010
"""
1111
import matplotlib.pyplot as plt

examples/images_contours_and_fields/pcolormesh_levels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pcolormesh
44
==========
55
6-
`.axes.Axes.pcolormesh` allows you to generate 2-D image-style plots. Note it
6+
`.axes.Axes.pcolormesh` allows you to generate 2D image-style plots. Note it
77
is faster than the similar `~.axes.Axes.pcolor`.
88
99
"""

examples/mplot3d/quiver3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
3D quiver plot
44
==============
55
6-
Demonstrates plotting directional arrows at points on a 3d meshgrid.
6+
Demonstrates plotting directional arrows at points on a 3D meshgrid.
77
"""
88

99
import matplotlib.pyplot as plt

examples/statistics/hexbin_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Plotting hexbins with Matplotlib.
77
88
Hexbin is an axes method or pyplot function that is essentially
9-
a pcolor of a 2-D histogram with hexagonal cells. It can be
9+
a pcolor of a 2D histogram with hexagonal cells. It can be
1010
much more informative than a scatter plot. In the first plot
1111
below, try substituting 'scatter' for 'hexbin'.
1212
"""

lib/matplotlib/_cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def cubehelix(gamma=1.0, s=0.5, r=-1.5, h=1.0):
7676
can be visualised as a squashed helix around the diagonal in the
7777
(r, g, b) color cube.
7878
79-
For a unit color cube (i.e. 3-D coordinates for (r, g, b) each in the
79+
For a unit color cube (i.e. 3D coordinates for (r, g, b) each in the
8080
range 0 to 1) the color scheme starts at (r, g, b) = (0, 0, 0), i.e. black,
8181
and finishes at (r, g, b) = (1, 1, 1), i.e. white. For some fraction *x*,
8282
between 0 and 1, the color is the corresponding grey value at that

lib/matplotlib/axes/_axes.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,11 +2028,11 @@ def step(self, x, y, *args, where='pre', data=None, **kwargs):
20282028
Parameters
20292029
----------
20302030
x : array-like
2031-
1-D sequence of x positions. It is assumed, but not checked, that
2031+
1D sequence of x positions. It is assumed, but not checked, that
20322032
it is uniformly increasing.
20332033
20342034
y : array-like
2035-
1-D sequence of y levels.
2035+
1D sequence of y levels.
20362036
20372037
fmt : str, optional
20382038
A format string, e.g. 'g' for a green line. See `.plot` for a more
@@ -4200,7 +4200,7 @@ def invalid_shape_exception(csize, xsize):
42004200
"RGBA sequence, which should be avoided as value-"
42014201
"mapping will have precedence in case its length "
42024202
"matches with *x* & *y*. Please use the *color* "
4203-
"keyword-argument or provide a 2-D array "
4203+
"keyword-argument or provide a 2D array "
42044204
"with a single row if you intend to specify "
42054205
"the same RGB or RGBA value for all points.")
42064206
valid_shape = False
@@ -4253,14 +4253,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
42534253
42544254
- A scalar or sequence of n numbers to be mapped to colors using
42554255
*cmap* and *norm*.
4256-
- A 2-D array in which the rows are RGB or RGBA.
4256+
- A 2D array in which the rows are RGB or RGBA.
42574257
- A sequence of colors of length n.
42584258
- A single color format string.
42594259
42604260
Note that *c* should not be a single numeric RGB or RGBA sequence
42614261
because that is indistinguishable from an array of values to be
42624262
colormapped. If you want to specify the same RGB or RGBA value for
4263-
all points, use a 2-D array with a single row. Otherwise, value-
4263+
all points, use a 2D array with a single row. Otherwise, value-
42644264
matching will have precedence in case of a size matching with *x*
42654265
and *y*.
42664266
@@ -4341,7 +4341,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
43414341
case all masks will be combined and only unmasked points will be
43424342
plotted.
43434343
4344-
* Fundamentally, scatter works with 1-D arrays; *x*, *y*, *s*, and *c*
4344+
* Fundamentally, scatter works with 1D arrays; *x*, *y*, *s*, and *c*
43454345
may be input as N-D arrays, but within scatter they will be
43464346
flattened. The exception is *c*, which will be flattened only if its
43474347
size matches the size of *x* and *y*.
@@ -5597,7 +5597,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
55975597
Parameters
55985598
----------
55995599
C : array-like
5600-
A scalar 2-D array. The values will be color-mapped.
5600+
A scalar 2D array. The values will be color-mapped.
56015601
56025602
X, Y : array-like, optional
56035603
The coordinates of the corners of quadrilaterals of a pcolormesh::
@@ -5623,7 +5623,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
56235623
color ``C[i, j]`` will be centered on ``(X[i, j], Y[i, j])``.
56245624
56255625
If *X* and/or *Y* are 1-D arrays or column vectors they will be
5626-
expanded as needed into the appropriate 2-D arrays, making a
5626+
expanded as needed into the appropriate 2D arrays, making a
56275627
rectangular grid.
56285628
56295629
shading : {'flat', 'nearest', 'auto'}, optional
@@ -5841,7 +5841,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
58415841
Parameters
58425842
----------
58435843
C : array-like
5844-
A scalar 2-D array. The values will be color-mapped.
5844+
A scalar 2D array. The values will be color-mapped.
58455845
58465846
X, Y : array-like, optional
58475847
The coordinates of the corners of quadrilaterals of a pcolormesh::
@@ -5869,7 +5869,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
58695869
interpolation is caried out between the quadrilateral corners.
58705870
58715871
If *X* and/or *Y* are 1-D arrays or column vectors they will be
5872-
expanded as needed into the appropriate 2-D arrays, making a
5872+
expanded as needed into the appropriate 2D arrays, making a
58735873
rectangular grid.
58745874
58755875
cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
@@ -5970,7 +5970,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
59705970
59715971
**Differences between pcolor() and pcolormesh()**
59725972
5973-
Both methods are used to create a pseudocolor plot of a 2-D array
5973+
Both methods are used to create a pseudocolor plot of a 2D array
59745974
using quadrilaterals.
59755975
59765976
The main difference lies in the created object and internal data
@@ -6300,7 +6300,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
63006300
63016301
Multiple data can be provided via *x* as a list of datasets
63026302
of potentially different length ([*x0*, *x1*, ...]), or as
6303-
a 2-D ndarray in which each column is a dataset. Note that
6303+
a 2D ndarray in which each column is a dataset. Note that
63046304
the ndarray form is transposed relative to the list form.
63056305
63066306
Masked arrays are not supported.
@@ -7478,7 +7478,7 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
74787478
74797479
Returns
74807480
-------
7481-
spectrum : 2-D array
7481+
spectrum : 2D array
74827482
Columns are the periodograms of successive segments.
74837483
74847484
freqs : 1-D array

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def _plot_args(self, tup, kwargs, return_kwargs=False):
430430
raise ValueError(f"x and y must have same first dimension, but "
431431
f"have shapes {x.shape} and {y.shape}")
432432
if x.ndim > 2 or y.ndim > 2:
433-
raise ValueError(f"x and y can be no greater than 2-D, but have "
433+
raise ValueError(f"x and y can be no greater than 2D, but have "
434434
f"shapes {x.shape} and {y.shape}")
435435
if x.ndim == 1:
436436
x = x[:, np.newaxis]

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ def _to_unmasked_float_array(x):
13001300

13011301

13021302
def _check_1d(x):
1303-
"""Convert scalars to 1d arrays; pass-through arrays as is."""
1303+
"""Convert scalars to 1D arrays; pass-through arrays as is."""
13041304
if not hasattr(x, 'shape') or len(x.shape) < 1:
13051305
return np.atleast_1d(x)
13061306
else:

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
295295
"""
296296
Return a normalized rgba array corresponding to *x*.
297297
298-
In the normal case, *x* is a 1-D or 2-D sequence of scalars, and
298+
In the normal case, *x* is a 1D or 2D sequence of scalars, and
299299
the corresponding ndarray of rgba values will be returned,
300300
based on the norm and colormap set for this ScalarMappable.
301301

0 commit comments

Comments
 (0)