Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Fix spelling and grammar in examples #24525

Merged
merged 1 commit into from Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/axes_grid1/demo_axes_divider.py
@@ -1,6 +1,6 @@
"""
============
Axes Divider
Axes divider
============

Axes divider to calculate location of axes and
Expand Down Expand Up @@ -112,7 +112,7 @@ def demo():

# PLOT 3
# image and colorbar whose location is adjusted in the drawing time.
# a easy way
# an easy way

ax = fig.add_subplot(2, 2, 3)
demo_locatable_axes_easy(ax)
Expand Down
10 changes: 5 additions & 5 deletions examples/axes_grid1/inset_locator_demo.py
@@ -1,6 +1,6 @@
"""
==================
Inset Locator Demo
Inset locator demo
==================

"""
Expand Down Expand Up @@ -45,7 +45,7 @@

###############################################################################
# The parameters *bbox_to_anchor* and *bbox_transform* can be used for a more
# fine grained control over the inset position and size or even to position
# fine-grained control over the inset position and size or even to position
# the inset at completely arbitrary positions.
# The *bbox_to_anchor* sets the bounding box in coordinates according to the
# *bbox_transform*.
Expand All @@ -54,12 +54,12 @@
fig = plt.figure(figsize=[5.5, 2.8])
ax = fig.add_subplot(121)

# We use the axes transform as bbox_transform. Therefore the bounding box
# We use the axes transform as bbox_transform. Therefore, the bounding box
# needs to be specified in axes coordinates ((0, 0) is the lower left corner
# of the axes, (1, 1) is the upper right corner).
# The bounding box (.2, .4, .6, .5) starts at (.2, .4) and ranges to (.8, .9)
# in those coordinates.
# Inside of this bounding box an inset of half the bounding box' width and
# Inside this bounding box an inset of half the bounding box' width and
# three quarters of the bounding box' height is created. The lower left corner
# of the inset is aligned to the lower left corner of the bounding box (loc=3).
# The inset is then offset by the default 0.5 in units of the font size.
Expand Down Expand Up @@ -103,7 +103,7 @@
###############################################################################
# In the above the axes transform together with 4-tuple bounding boxes has been
# used as it mostly is useful to specify an inset relative to the axes it is
# an inset to. However other use cases are equally possible. The following
# an inset to. However, other use cases are equally possible. The following
# example examines some of those.
#

Expand Down
6 changes: 3 additions & 3 deletions examples/axes_grid1/inset_locator_demo2.py
@@ -1,9 +1,9 @@
"""
====================
Inset Locator Demo 2
Inset locator demo 2
====================

This Demo shows how to create a zoomed inset via `.zoomed_inset_axes`.
This demo shows how to create a zoomed inset via `.zoomed_inset_axes`.
In the first subplot an `.AnchoredSizeBar` shows the zoom effect.
In the second subplot a connection to the region of interest is
created via `.mark_inset`.
Expand Down Expand Up @@ -63,7 +63,7 @@ def add_sizebar(ax, size):
axins2 = zoomed_inset_axes(ax2, zoom=6, loc=1)
axins2.imshow(Z2, extent=extent, origin="lower")

# sub region of the original image
# subregion of the original image
x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
axins2.set_xlim(x1, x2)
axins2.set_ylim(y1, y2)
Expand Down
4 changes: 2 additions & 2 deletions examples/axes_grid1/simple_axes_divider3.py
@@ -1,6 +1,6 @@
"""
=====================
Simple Axes Divider 3
Simple axes divider 3
=====================
See also :doc:`/tutorials/toolkits/axes_grid`.
Expand All @@ -13,7 +13,7 @@

fig = plt.figure(figsize=(5.5, 4))

# the rect parameter will be ignore as we will set axes_locator
# the rect parameter will be ignored as we will set axes_locator
rect = (0.1, 0.1, 0.8, 0.8)
ax = [fig.add_axes(rect, label="%d" % i) for i in range(4)]

Expand Down
14 changes: 7 additions & 7 deletions examples/event_handling/cursor_demo.py
@@ -1,15 +1,15 @@
"""
=================
Cross hair cursor
Cross-hair cursor
=================

This example adds a cross hair as a data cursor. The cross hair is
This example adds a cross-hair as a data cursor. The cross-hair is
implemented as regular line objects that are updated on mouse move.

We show three implementations:

1) A simple cursor implementation that redraws the figure on every mouse move.
This is a bit slow and you may notice some lag of the cross hair movement.
This is a bit slow, and you may notice some lag of the cross-hair movement.
2) A cursor that uses blitting for speedup of the rendering.
3) A cursor that snaps to data points.

Expand Down Expand Up @@ -76,18 +76,18 @@ def on_mouse_move(self, event):
# Faster redrawing using blitting
# """""""""""""""""""""""""""""""
# This technique stores the rendered plot as a background image. Only the
# changed artists (cross hair lines and text) are rendered anew. They are
# changed artists (cross-hair lines and text) are rendered anew. They are
# combined with the background using blitting.
#
# This technique is significantly faster. It requires a bit more setup because
# the background has to be stored without the cross hair lines (see
# the background has to be stored without the cross-hair lines (see
# ``create_new_background()``). Additionally, a new background has to be
# created whenever the figure changes. This is achieved by connecting to the
# ``'draw_event'``.

class BlittedCursor:
"""
A cross hair cursor using blitting for faster redraw.
A cross-hair cursor using blitting for faster redraw.
"""
def __init__(self, ax):
self.ax = ax
Expand Down Expand Up @@ -167,7 +167,7 @@ def on_mouse_move(self, event):

class SnappingCursor:
"""
A cross hair cursor that snaps to the data point of a line, which is
A cross-hair cursor that snaps to the data point of a line, which is
closest to the *x* position of the cursor.

For simplicity, this assumes that *x* values of the data are sorted.
Expand Down
4 changes: 2 additions & 2 deletions examples/event_handling/data_browser.py
@@ -1,12 +1,12 @@
"""
============
Data Browser
Data browser
============

Connecting data between multiple canvases.

This example covers how to interact data with multiple canvases. This
let's you select and highlight a point on one axis, and generating the
lets you select and highlight a point on one axis, and generating the
data of that point on the other axis.

.. note::
Expand Down
4 changes: 2 additions & 2 deletions examples/event_handling/legend_picking.py
@@ -1,6 +1,6 @@
"""
==============
Legend Picking
Legend picking
==============

Enable picking on the legend to toggle the original line on and off
Expand Down Expand Up @@ -42,7 +42,7 @@ def on_pick(event):
origline = lined[legline]
visible = not origline.get_visible()
origline.set_visible(visible)
# Change the alpha on the line in the legend so we can see what lines
# Change the alpha on the line in the legend, so we can see what lines
# have been toggled.
legline.set_alpha(1.0 if visible else 0.2)
fig.canvas.draw()
Expand Down
4 changes: 2 additions & 2 deletions examples/event_handling/path_editor.py
@@ -1,6 +1,6 @@
"""
===========
Path Editor
Path editor
===========

Sharing events across GUIs.
Expand Down Expand Up @@ -47,7 +47,7 @@

class PathInteractor:
"""
An path editor.
A path editor.

Press 't' to toggle vertex markers on and off. When vertex markers are on,
they can be dragged with the mouse.
Expand Down
4 changes: 2 additions & 2 deletions examples/event_handling/pick_event_demo.py
@@ -1,6 +1,6 @@
"""
===============
Pick Event Demo
Pick event demo
===============

You can enable picking by setting the "picker" property of an artist
Expand Down Expand Up @@ -56,7 +56,7 @@ def pick_handler(event):
the matplotlib.artist that generated the pick event.

Additionally, certain artists like Line2D and PatchCollection may
attach additional meta data like the indices into the data that meet
attach additional metadata like the indices into the data that meet
the picker criteria (for example, all the points in the line that are within
the specified epsilon tolerance)

Expand Down
6 changes: 3 additions & 3 deletions examples/event_handling/pick_event_demo2.py
@@ -1,7 +1,7 @@
"""
================
Pick Event Demo2
================
=================
Pick event demo 2
=================

Compute the mean (mu) and standard deviation (sigma) of 100 data sets and plot
mu vs. sigma. When you click on one of the (mu, sigma) points, plot the raw
Expand Down
14 changes: 6 additions & 8 deletions examples/images_contours_and_fields/colormap_normalizations.py
@@ -1,6 +1,6 @@
"""
=======================
Colormap Normalizations
Colormap normalizations
=======================

Demonstration of using norm to map colormaps onto data in non-linear ways.
Expand All @@ -20,8 +20,8 @@
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]

# A low hump with a spike coming out of the top. Needs to have
# z/colour axis on a log scale so we see both hump and spike. linear
# scale only shows the spike.
# z/colour axis on a log scale, so we see both hump and spike.
# A linear scale only shows the spike.

Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X * 10)**2 - (Y * 10)**2)
Expand Down Expand Up @@ -63,19 +63,17 @@
# Note that colorbar labels do not come out looking very good.

X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
Z1 = 5 * np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2
Z = 5 * np.exp(-X**2 - Y**2)

fig, ax = plt.subplots(2, 1)

pcm = ax[0].pcolormesh(X, Y, Z1,
pcm = ax[0].pcolormesh(X, Y, Z,
norm=colors.SymLogNorm(linthresh=0.03, linscale=0.03,
vmin=-1.0, vmax=1.0, base=10),
cmap='RdBu_r', shading='nearest')
fig.colorbar(pcm, ax=ax[0], extend='both')

pcm = ax[1].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1),
pcm = ax[1].pcolormesh(X, Y, Z, cmap='RdBu_r', vmin=-np.max(Z),
shading='nearest')
fig.colorbar(pcm, ax=ax[1], extend='both')

Expand Down
@@ -1,6 +1,6 @@
"""
==================================
Colormap Normalizations SymLogNorm
Colormap normalizations SymLogNorm
==================================

Demonstration of using norm to map colormaps onto data in non-linear ways.
Expand Down
4 changes: 2 additions & 2 deletions examples/images_contours_and_fields/contourf_demo.py
@@ -1,6 +1,6 @@
"""
=============
Contourf Demo
Contourf demo
=============

How to use the `.axes.Axes.contourf` method to create filled contour plots.
Expand Down Expand Up @@ -97,7 +97,7 @@
cmap = plt.colormaps["winter"].with_extremes(under="magenta", over="yellow")
# Note: contouring simply excludes masked or nan regions, so
# instead of using the "bad" colormap value for them, it draws
# nothing at all in them. Therefore the following would have
# nothing at all in them. Therefore, the following would have
# no effect:
# cmap.set_bad("red")

Expand Down
4 changes: 2 additions & 2 deletions examples/images_contours_and_fields/contourf_log.py
Expand Up @@ -18,8 +18,8 @@
X, Y = np.meshgrid(x, y)

# A low hump with a spike coming out.
# Needs to have z/colour axis on a log scale so we see both hump and spike.
# linear scale only shows the spike.
# Needs to have z/colour axis on a log scale, so we see both hump and spike.
# A linear scale only shows the spike.
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X * 10)**2 - (Y * 10)**2)
z = Z1 + 50 * Z2
Expand Down
Expand Up @@ -33,7 +33,7 @@
# tick labels (`~matplotlib.axes.Axes.set_xticklabels`),
# otherwise they would become out of sync. The locations are just
# the ascending integer numbers, while the ticklabels are the labels to show.
# Finally we can label the data itself by creating a `~matplotlib.text.Text`
# Finally, we can label the data itself by creating a `~matplotlib.text.Text`
# within each cell showing the value of that cell.


Expand Down
8 changes: 4 additions & 4 deletions examples/images_contours_and_fields/image_antialiasing.py
Expand Up @@ -12,7 +12,7 @@
When subsampling data, aliasing is reduced by smoothing first and then
subsampling the smoothed data. In Matplotlib, we can do that
smoothing before mapping the data to colors, or we can do the smoothing
on the RGB(A) data in the final image. The difference between these is
on the RGB(A) data in the final image. The differences between these are
shown below, and controlled with the *interpolation_stage* keyword argument.

The default image interpolation in Matplotlib is 'antialiased', and
Expand Down Expand Up @@ -49,9 +49,9 @@
###############################################################################
# The following images are subsampled from 450 data pixels to either
# 125 pixels or 250 pixels (depending on your display).
# The Moire patterns in the 'nearest' interpolation are caused by the
# The Moiré patterns in the 'nearest' interpolation are caused by the
# high-frequency data being subsampled. The 'antialiased' imaged
# still has some Moire patterns as well, but they are greatly reduced.
# still has some Moiré patterns as well, but they are greatly reduced.
#
# There are substantial differences between the 'data' interpolation and
# the 'rgba' interpolation. The alternating bands of red and blue on the
Expand Down Expand Up @@ -81,7 +81,7 @@
plt.show()

###############################################################################
# Even up-sampling an image with 'nearest' interpolation will lead to Moire
# Even up-sampling an image with 'nearest' interpolation will lead to Moiré
# patterns when the upsampling factor is not integer. The following image
# upsamples 500 data pixels to 530 rendered pixels. You may note a grid of
# 30 line-like artifacts which stem from the 524 - 500 = 24 extra pixels that
Expand Down
2 changes: 1 addition & 1 deletion examples/images_contours_and_fields/image_demo.py
@@ -1,6 +1,6 @@
"""
==========
Image Demo
Image demo
==========

Many ways to plot images in Matplotlib.
Expand Down
4 changes: 2 additions & 2 deletions examples/images_contours_and_fields/image_nonuniform.py
@@ -1,10 +1,10 @@
"""
================
Image Nonuniform
Image nonuniform
================

This illustrates the NonUniformImage class. It is not
available via an Axes method but it is easily added to an
available via an Axes method, but it is easily added to an
Axes instance as shown here.
"""

Expand Down
6 changes: 3 additions & 3 deletions examples/images_contours_and_fields/matshow.py
@@ -1,7 +1,7 @@
"""
=======
Matshow
=======
===============================
Visualize matrices with matshow
===============================

`~.axes.Axes.matshow` visualizes a 2D matrix or array as color-coded image.
"""
Expand Down
6 changes: 3 additions & 3 deletions examples/images_contours_and_fields/multi_image.py
@@ -1,7 +1,7 @@
"""
===========
Multi Image
===========
===============
Multiple images
===============

Make a set of images with a single colormap, norm, and colorbar.
"""
Expand Down