8000 Merge pull request #24526 from oscargus/tutorialspelling · matplotlib/matplotlib@6649511 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6649511

Browse files
authored
Merge pull request #24526 from oscargus/tutorialspelling
[Doc] Fix spelling and grammar in tutorials
2 parents 4fda5ff + 35771d3 commit 6649511

15 files changed

+43
-43
lines changed

tutorials/advanced/blitting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
.. warning::
4242
4343
This code does not work with the OSX backend (but does work with other
44-
GUI backends on mac).
44+
GUI backends on Mac).
4545
4646
Minimal example
4747
---------------
@@ -106,7 +106,7 @@
106106
# pixels changes (due to either the size or dpi of the figure
107107
# changing) , the background will be invalid and result in incorrect
108108
# (but sometimes cool looking!) images. There is also a global
109-
# variable and a fair amount of boiler plate which suggests we should
109+
# variable and a fair amount of boilerplate which suggests we should
110110
# wrap this in a class.
111111
#
112112
# Class-based example
@@ -125,7 +125,7 @@ def __init__(self, canvas, animated_artists=()):
125125
Parameters
126126
----------
127127
canvas : FigureCanvasAgg
128-
The canvas to work with, this only works for sub-classes of the Agg
128+
The canvas to work with, this only works for subclasses of the Agg
129129
canvas which have the `~FigureCanvasAgg.copy_from_bbox` and
130130
`~FigureCanvasAgg.restore_region` methods.
131131

tutorials/advanced/path_tutorial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
the :class:`~matplotlib.path.Path`, which supports the standard set of
1010
moveto, lineto, curveto commands to draw simple and compound outlines
1111
consisting of line segments and splines. The ``Path`` is instantiated
12-
with a (N, 2) array of (x, y) vertices, and a N-length array of path
12+
with a (N, 2) array of (x, y) vertices, and an N-length array of path
1313
codes. For example to draw the unit rectangle from (0, 0) to (1, 1), we
1414
could use this code:
1515
"""
@@ -148,7 +148,7 @@
148148
# n, bins = np.histogram(data, 100)
149149
#
150150
# We'll now extract the corners of the rectangles. Each of the
151-
# ``left``, ``bottom``, etc, arrays below is ``len(n)``, where ``n`` is
151+
# ``left``, ``bottom``, etc., arrays below is ``len(n)``, where ``n`` is
152152
# the array of counts for each histogram bar::
153153
#
154154
# # get the corners of the rectangles for the histogram
@@ -161,7 +161,7 @@
161161
# series of ``MOVETO``, ``LINETO`` and ``CLOSEPOLY`` for each rectangle.
162162
# For each rectangle, we need five vertices: one for the ``MOVETO``,
163163
# three for the ``LINETO``, and one for the ``CLOSEPOLY``. As indicated
164-
# in the table above, the vertex for the closepoly is ignored but we still
164+
# in the table above, the vertex for the closepoly is ignored, but we still
165165
# need it to keep the codes aligned with the vertices::
166166
#
167167
# nverts = nrects*(1+3+1)

tutorials/advanced/transforms_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
system, and the *display* coordinate system. In 95% of your plotting, you
1010
won't need to think about this, as it happens under the hood, but as you push
1111
the limits of custom figure generation, it helps to have an understanding of
12-
these objects so you can reuse the existing transformations Matplotlib makes
12+
these objects, so you can reuse the existing transformations Matplotlib makes
1313
available to you, or create your own (see :mod:`matplotlib.transforms`). The
1414
table below summarizes some useful coordinate systems, a description of each
1515
system, and the transformation object for going from each coordinate system to
@@ -91,7 +91,7 @@
9191
Note that specifying the position of Artists in *display* coordinates may
9292
change their relative location if the ``dpi`` or size of the figure changes.
9393
This can cause confusion when printing or changing screen resolution, because
94-
the object can change location and size. Therefore it is most common for
94+
the object can change location and size. Therefore, it is most common for
9595
artists placed in an Axes or figure to have their transform set to something
9696
*other* than the `~.transforms.IdentityTransform()`; the default when an artist
9797
is added to an Axes using `~.axes.Axes.add_artist` is for the transform to be
@@ -291,7 +291,7 @@
291291
# coordinates is extremely useful, for example to create a horizontal
292292
# span which highlights some region of the y-data but spans across the
293293
# x-axis regardless of the data limits, pan or zoom level, etc. In fact
294-
# these blended lines and spans are so useful, we have built in
294+
# these blended lines and spans are so useful, we have built-in
295295
# functions to make them easy to plot (see
296296
# :meth:`~matplotlib.axes.Axes.axhline`,
297297
# :meth:`~matplotlib.axes.Axes.axvline`,
@@ -430,7 +430,7 @@
430430
# Another use of :class:`~matplotlib.transforms.ScaledTranslation` is to create
431431
# a new transformation that is
432432
# offset from another transformation, e.g., to place one object shifted a
433-
# bit relative to another object. Typically you want the shift to be in
433+
# bit relative to another object. Typically, you want the shift to be in
434434
# some physical dimension, like points or inches rather than in *data*
435435
# coordinates, so that the shift effect is constant at different zoom
436436
# levels and dpi settings.

tutorials/colors/colormapnorms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
5454

5555
# A low hump with a spike coming out of the top right. Needs to have
56-
# z/colour axis on a log scale so we see both hump and spike. linear
56+
# z/colour axis on a log scale, so we see both hump and spike. A linear
5757
# scale only shows the spike.
5858
Z1 = np.exp(-X**2 - Y**2)
5959
Z2 = np.exp(-(X * 10)**2 - (Y * 10)**2)

tutorials/colors/colormaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def plot_color_gradients(category, cmap_list):
285285
# https://stackoverflow.com/q/8202605/
286286

287287
if cmap_category == 'Sequential':
288-
# These colormaps all start at high lightness but we want them
288+
# These colormaps all start at high lightness, but we want them
289289
# reversed to look nice in the plot, so reverse the order.
290290
y_ = lab[0, ::-1, 0]
291291
c_ = x[::-1]

tutorials/intermediate/arranging_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
fig.suptitle('plt.subplots()')
112112

113113
##############################################################################
114-
# We will annotate a lot of Axes, so lets encapsulate the annotation, rather
114+
# We will annotate a lot of Axes, so let's encapsulate the annotation, rather
115115
# than having that large piece of annotation code every time we need it:
116116

117117

tutorials/intermediate/artists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class in the Matplotlib API, and the one you will be working with most
556556
# :attr:`~matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis``
557557
# containers will be detailed below, but note that the ``Axes`` contains
558558
# many helper methods which forward calls on to the
559-
# :class:`~matplotlib.axis.Axis` instances so you often do not need to
559+
# :class:`~matplotlib.axis.Axis` instances, so you often do not need to
560560
# work with them directly unless you want to. For example, you can set
561561
# the font color of the ``XAxis`` ticklabels using the ``Axes`` helper
562562
# method::

tutorials/intermediate/constrainedlayout_guide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def example_plot(ax, fontsize=12, hide_labels=False):
599599
# ======================
600600
#
601601
# The algorithm for the constraint is relatively straightforward, but
602-
# has some complexity due to the complex ways we can layout a figure.
602+
# has some complexity due to the complex ways we can lay out a figure.
603603
#
604604
# Layout in Matplotlib is carried out with gridspecs
605605
# via the `.GridSpec` class. A gridspec is a logical division of the figure
@@ -611,7 +611,7 @@ def example_plot(ax, fontsize=12, hide_labels=False):
611611
# for each column, and ``bottom`` and ``top`` variables for each row, and
612612
# further it has a margin for each of left, right, bottom and top. In each
613613
# row, the bottom/top margins are widened until all the decorators
614-
# in that row are accommodated. Similarly for columns and the left/right
614+
# in that row are accommodated. Similarly, for columns and the left/right
615615
# margins.
616616
#
617617
#

tutorials/intermediate/tight_layout_guide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def example_plot(ax, fontsize=12):
161161
# are rare cases where it is not.
162162
#
163163
# * ``pad=0`` can clip some texts by a few pixels. This may be a bug or
164-
# a limitation of the current algorithm and it is not clear why it
164+
# a limitation of the current algorithm, and it is not clear why it
165165
# happens. Meanwhile, use of pad larger than 0.3 is recommended.
166166
#
167167
# Use with GridSpec
@@ -213,7 +213,7 @@ def example_plot(ax, fontsize=12):
213213
# =======================
214214
#
215215
# Pre Matplotlib 2.2, legends and annotations were excluded from the bounding
216-
# box calculations that decide the layout. Subsequently these artists were
216+
# box calculations that decide the layout. Subsequently, these artists were
217217
# added to the calculation, but sometimes it is undesirable to include them.
218218
# For instance in this case it might be good to have the axes shrink a bit
219219
# to make room for the legend:

tutorials/introductory/lifecycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
3737
* The `.Figure` is the final image, and may contain one or more `~.axes.Axes`.
3838
* The `~.axes.Axes` represents an individual plot (not to be confused with
39-
`~.axis.Axis`, which refers to the x/y axis of a plot).
39+
`~.axis.Axis`, which refers to the x-, y-, or z-axis of a plot).
4040
4141
We call methods that do the plotting directly from the Axes, which gives
4242
us much more flexibility and power in customizing our plot.

tutorials/introductory/pyplot.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"""
1212

1313
###############################################################################
14-
# Intro to pyplot
15-
# ===============
14+
# Introduction to pyplot
15+
# ======================
1616
#
1717
# :mod:`matplotlib.pyplot` is a collection of functions that make matplotlib
1818
# work like MATLAB. Each ``pyplot`` function makes some change to a figure:
@@ -29,11 +29,11 @@
2929
#
3030
# .. note::
3131
#
32-
# the implicit pyplot API is generally less verbose but also not as flexible as the
32+
# The implicit pyplot API is generally less verbose but also not as flexible as the
3333
# explicit API. Most of the function calls you see here can also be called
3434
# as methods from an ``Axes`` object. We recommend browsing the tutorials
3535
# and examples to see how this works. See :ref:`api_interfaces` for an
36-
# explanation of the trade off of the supported user APIs.
36+
# explanation of the trade-off of the supported user APIs.
3737
#
3838
# Generating visualizations with pyplot is very quick:
3939

@@ -48,7 +48,7 @@
4848
# `~.pyplot.plot`, matplotlib assumes it is a
4949
# sequence of y values, and automatically generates the x values for
5050
# you. Since python ranges start with 0, the default x vector has the
51-
# same length as y but starts with 0. Hence the x data are
51+
# same length as y but starts with 0; therefore, the x data are
5252
# ``[0, 1, 2, 3]``.
5353
#
5454
# `~.pyplot.plot` is a versatile function, and will take an arbitrary number of
@@ -104,7 +104,7 @@
104104
# access particular variables with strings. For example, with
105105
# `numpy.recarray` or `pandas.DataFrame`.
106106
#
107-
# Matplotlib allows you provide such an object with
107+
# Matplotlib allows you to provide such an object with
108108
# the ``data`` keyword argument. If provided, then you may generate plots with
109109
# the strings corresponding to these variables.
110110

@@ -355,7 +355,7 @@ def f(t):
355355
# Using mathematical expressions in text
356356
# --------------------------------------
357357
#
358-
# matplotlib accepts TeX equation expressions in any text expression.
358+
# Matplotlib accepts TeX equation expressions in any text expression.
359359
# For example to write the expression :math:`\sigma_i=15` in the title,
360360
# you can write a TeX expression surrounded by dollar signs::
361361
#
@@ -365,9 +365,9 @@ def f(t):
365365
# that the string is a *raw* string and not to treat backslashes as
366366
# python escapes. matplotlib has a built-in TeX expression parser and
367367
# layout engine, and ships its own math fonts -- for details see
368-
# :doc:`/tutorials/text/mathtext`. Thus you can use mathematical text across platforms
369-
# without requiring a TeX installation. For those who have LaTeX and
370-
# dvipng installed, you can also use LaTeX to format your text and
368+
# :doc:`/tutorials/text/mathtext`. Thus, you can use mathematical text across
369+
# platforms without requiring a TeX installation. For those who have LaTeX
370+
# and dvipng installed, you can also use LaTeX to format your text and
371371
# incorporate the output directly into your display figures or saved
372372
# postscript -- see :doc:`/tutorials/text/usetex`.
373373
#
@@ -415,7 +415,7 @@ def f(t):
415415
#
416416
# plt.xscale('log')
417417
#
418-
# An example of four plots with the same data and different scales for the y axis
418+
# An example of four plots with the same data and different scales for the y-axis
419419
# is shown below.
420420

421421
# Fixing random state for reproducibility

tutorials/introductory/quick_start.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Matplotlib graphs your data on `.Figure`\s (e.g., windows, Jupyter
2424
# widgets, etc.), each of which can contain one or more `~.axes.Axes`, an
2525
# area where points can be specified in terms of x-y coordinates (or theta-r
26-
# in a polar plot, x-y-z in a 3D plot, etc). The simplest way of
26+
# in a polar plot, x-y-z in a 3D plot, etc.). The simplest way of
2727
# creating a Figure with an Axes is using `.pyplot.subplots`. We can then use
2828
# `.Axes.plot` to draw some data on the Axes:
2929

@@ -113,9 +113,9 @@
113113
# b_asarray = np.asarray(b)
114114
#
115115
# Most methods will also parse an addressable object like a *dict*, a
116-
# `numpy.recarray`, or a `pandas.DataFrame`. Matplotlib allows you provide
117-
# the ``data`` keyword argument and generate plots passing the strings
118-
# corresponding to the *x* and *y* variables.
116+
# `numpy.recarray`, or a `pandas.DataFrame`. Matplotlib allows you to
117+
# provide the ``data`` keyword argument and generate plots passing the
118+
# strings corresponding to the *x* and *y* variables.
119119
np.random.seed(19680801) # seed the random number generator.
120120
data = {'a': np.arange(50),
121121
'c': np.random.randint(0, 50, 50),

tutorials/provisional/mosaic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
make breaking changes in future versions with no warning.
1111
1212
13-
Laying out Axes in a Figure in a non uniform grid can be both tedious
13+
Laying out Axes in a Figure in a non-uniform grid can be both tedious
1414
and verbose. For dense, even grids we have `.Figure.subplots` but for
1515
more complex layouts, such as Axes that span multiple columns / rows
1616
of the layout or leave some areas of the Figure blank, you can use
@@ -139,8 +139,8 @@ def identify_axes(ax_dict, fontsize=48):
139139
# Axes spanning multiple rows/columns
140140
# ===================================
141141
#
142-
# Something we can do with `.Figure.subplot_mosaic` that you can not
143-
# do with `.Figure.subplots` is specify that an Axes should span
142+
# Something we can do with `.Figure.subplot_mosaic`, that we cannot
143+
# do with `.Figure.subplots`, is to specify that an Axes should span
144144
# several rows or columns.
145145

146146

@@ -289,7 +289,7 @@ def identify_axes(ax_dict, fontsize=48):
289289
# Nested list input
290290
# =================
291291
#
292-
# Everything we can do with the string short-hand we can also do when
292+
# Everything we can do with the string shorthand we can also do when
293293
# passing in a list (internally we convert the string shorthand to a nested
294294
# list), for example using spans, blanks, and *gridspec_kw*:
295295

tutorials/text/annotations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def custom_box_style(x0, y0, width, height, mutation_size):
317317
#
318318
# The behavior of each connection style is (limitedly) demonstrated in the
319319
# example below. (Warning: The behavior of the ``bar`` style is currently not
320-
# well defined and may be changed in the future).
320+
# well-defined and may be changed in the future).
321321
#
322322
# .. figure:: ../../gallery/userdemo/images/sphx_glr_connectionstyle_demo_001.png
323323
# :target: ../../gallery/userdemo/connectionstyle_demo.html
@@ -434,7 +434,7 @@ def custom_box_style(x0, y0, width, height, mutation_size):
434434
# pixel (radius = 10 pixel), you can utilize
435435
# `~mpl_toolkits.axes_grid1.anchored_artists.AnchoredDrawingArea`. The instance
436436
# is created with a size of the drawing area (in pixels), and arbitrary artists
437-
# can added to the drawing area. Note that the extents of the artists that are
437+
# can be added to the drawing area. Note that the extents of the artists that are
438438
# added to the drawing area are not related to the placement of the drawing
439439
# area itself. Only the initial size matters.
440440
#
@@ -575,7 +575,7 @@ def custom_box_style(x0, y0, width, height, mutation_size):
575575
#
576576
# 3. A callable object that takes the renderer instance as single argument, and
577577
# returns either a `.Transform` or a `.BboxBase`. For example, the return
578-
# value of `.Artist.get_window_extent` is a bbox, so this method is identical to
578+
# value of `.Artist.get_window_extent` is a bbox, so this method is identical
579579
# to (2) passing in the artist:
580580

581581
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(3, 3))

tutorials/text/text_intro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
# Simple ticks
251251
# ~~~~~~~~~~~~
252252
#
253-
# It often is convenient to simply define the
253+
# It is often convenient to simply define the
254254
# tick values, and sometimes the tick labels, overriding the default
255255
# locators and formatters. This is discouraged because it breaks interactive
256256
# navigation of the plot. It also can reset the axis limits: note that
@@ -323,7 +323,7 @@
323323
# ``nbins=auto`` uses an algorithm to determine how many ticks will
324324
# be acceptable based on how long the axis is. The fontsize of the
325325
# ticklabel is taken into account, but the length of the tick string
326-
# is not (because its not yet known.) In the bottom row, the
326+
# is not (because it's not yet known.) In the bottom row, the
327327
# ticklabels are quite large, so we set ``nbins=4`` to make the
328328
# labels fit in the right-hand plot.
329329

0 commit comments

Comments
 (0)
0