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

Skip to content

Commit 3ed6dc4

Browse files
committed
Fix cross-references in tutorials.
This is not 100%. There are still class attributes that don't seem to be able to be linked.
1 parent 1e93c5f commit 3ed6dc4

20 files changed

+170
-420
lines changed

doc/missing-references.json

Lines changed: 20 additions & 262 deletions
Large diffs are not rendered by default.

tutorials/advanced/path_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Defining paths in your Matplotlib visualization.
77
8-
The object underlying all of the :mod:`matplotlib.patch` objects is
8+
The object underlying all of the :mod:`matplotlib.patches` objects is
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
@@ -169,7 +169,7 @@
169169
# verts[3::5, 1] = bottom
170170
#
171171
# All that remains is to create the path, attach it to a
172-
# :class:`~matplotlib.patch.PathPatch`, and add it to our axes::
172+
# :class:`~matplotlib.patches.PathPatch`, and add it to our axes::
173173
#
174174
# barpath = path.Path(verts, codes)
175175
# patch = patches.PathPatch(barpath, facecolor='green',

tutorials/advanced/transforms_tutorial.py

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
66
Like any graphics packages, Matplotlib is built on top of a
77
transformation framework to easily move between coordinate systems,
8-
the userland `data` coordinate system, the `axes` coordinate system,
9-
the `figure` coordinate system, and the `display` coordinate system.
8+
the userland *data* coordinate system, the *axes* coordinate system,
9+
the *figure* coordinate system, and the *display* coordinate system.
1010
In 95% of your plotting, you won't need to think about this, as it
1111
happens under the hood, but as you push the limits of custom figure
1212
generation, it helps to have an understanding of these objects so you
1313
can reuse the existing transformations Matplotlib makes available to
1414
you, or create your own (see :mod:`matplotlib.transforms`). The table
1515
below summarizes the some useful coordinate systems, the transformation
1616
object you should use to work in that coordinate system, and the
17-
description of that system. In the `Transformation Object` column,
17+
description of that system. In the ``Transformation Object`` column,
1818
``ax`` is a :class:`~matplotlib.axes.Axes` instance, and ``fig`` is a
1919
:class:`~matplotlib.figure.Figure` instance.
2020
@@ -52,37 +52,36 @@
5252
+----------------+-----------------------------+-----------------------------------+
5353
5454
All of the transformation objects in the table above take inputs in
55-
their coordinate system, and transform the input to the ``display``
56-
coordinate system. That is why the ``display`` coordinate system has
55+
their coordinate system, and transform the input to the *display*
56+
coordinate system. That is why the *display* coordinate system has
5757
``None`` for the ``Transformation Object`` column -- it already is in
58-
display coordinates. The transformations also know how to invert
59-
themselves, to go from ``display`` back to the native coordinate system.
58+
*display* coordinates. The transformations also know how to invert
59+
themselves, to go from *display* back to the native coordinate system.
6060
This is particularly useful when processing events from the user
6161
interface, which typically occur in display space, and you want to
62-
know where the mouse click or key-press occurred in your data
62+
know where the mouse click or key-press occurred in your *data*
6363
coordinate system.
6464
65-
Note that specifying objects in ``display`` coordinates will change their
65+
Note that specifying objects in *display* coordinates will change their
6666
location if the ``dpi`` of the figure changes. This can cause confusion when
6767
printing or changing screen resolution, because the object can change location
6868
and size. Therefore it is most common
6969
for artists placed in an axes or figure to have their transform set to
7070
something *other* than the `~.transforms.IdentityTransform()`; the default when
71-
an artist is placed on an axes using `~.Axes.axes.add_artist` is for the
71+
an artist is placed on an axes using `~.axes.Axes.add_artist` is for the
7272
transform to be ``ax.transData``.
7373
7474
.. _data-coords:
7575
7676
Data coordinates
7777
================
7878
79-
Let's start with the most commonly used coordinate, the `data`
80-
coordinate system. Whenever you add data to the axes, Matplotlib
81-
updates the datalimits, most commonly updated with the
82-
:meth:`~matplotlib.axes.Axes.set_xlim` and
83-
:meth:`~matplotlib.axes.Axes.set_ylim` methods. For example, in the
84-
figure below, the data limits stretch from 0 to 10 on the x-axis, and
85-
-1 to 1 on the y-axis.
79+
Let's start with the most commonly used coordinate, the *data* coordinate
80+
system. Whenever you add data to the axes, Matplotlib updates the datalimits,
81+
most commonly updated with the :meth:`~matplotlib.axes.Axes.set_xlim` and
82+
:meth:`~matplotlib.axes.Axes.set_ylim` methods. For example, in the figure
83+
below, the data limits stretch from 0 to 10 on the x-axis, and -1 to 1 on the
84+
y-axis.
8685
"""
8786

8887
import numpy as np
@@ -101,7 +100,7 @@
101100

102101
###############################################################################
103102
# You can use the ``ax.transData`` instance to transform from your
104-
# `data` to your `display` coordinate system, either a single point or a
103+
# *data* to your *display* coordinate system, either a single point or a
105104
# sequence of points as shown below:
106105
#
107106
# .. sourcecode:: ipython
@@ -118,7 +117,7 @@
118117
# [ 132.435, 642.2 ]])
119118
#
120119
# You can use the :meth:`~matplotlib.transforms.Transform.inverted`
121-
# method to create a transform which will take you from display to data
120+
# method to create a transform which will take you from *display* to *data*
122121
# coordinates:
123122
#
124123
# .. sourcecode:: ipython
@@ -132,7 +131,7 @@
132131
# Out[43]: array([ 5., 0.])
133132
#
134133
# If your are typing along with this tutorial, the exact values of the
135-
# display coordinates may differ if you have a different window size or
134+
# *display* coordinates may differ if you have a different window size or
136135
# dpi setting. Likewise, in the figure below, the display labeled
137136
# points are probably not the same as in the ipython session because the
138137
# documentation figure size defaults are different.
@@ -170,14 +169,14 @@
170169
# .. note::
171170
#
172171
# If you run the source code in the example above in a GUI backend,
173-
# you may also find that the two arrows for the `data` and `display`
172+
# you may also find that the two arrows for the *data* and *display*
174173
# annotations do not point to exactly the same point. This is because
175174
# the display point was computed before the figure was displayed, and
176175
# the GUI backend may slightly resize the figure when it is created.
177176
# The effect is more pronounced if you resize the figure yourself.
178-
# This is one good reason why you rarely want to work in display
177+
# This is one good reason why you rarely want to work in *display*
179178
# space, but you can connect to the ``'on_draw'``
180-
# :class:`~matplotlib.backend_bases.Event` to update figure
179+
# :class:`~matplotlib.backend_bases.Event` to update *figure*
181180
# coordinates on figure draws; see :ref:`event-handling-tutorial`.
182181
#
183182
# When you change the x or y limits of your axes, the data limits are
@@ -210,7 +209,7 @@
210209
# Axes coordinates
211210
# ================
212211
#
213-
# After the `data` coordinate system, `axes` is probably the second most
212+
# After the *data* coordinate system, *axes* is probably the second most
214213
# useful coordinate system. Here the point (0, 0) is the bottom left of
215214
# your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the
216215
# top right. You can also refer to points outside the range, so (-0.1,
@@ -230,16 +229,16 @@
230229
plt.show()
231230

232231
###############################################################################
233-
# You can also make lines or patches in the axes coordinate system, but
232+
# You can also make lines or patches in the *axes* coordinate system, but
234233
# this is less useful in my experience than using ``ax.transAxes`` for
235234
# placing text. Nonetheless, here is a silly example which plots some
236-
# random dots in `data` space, and overlays a semi-transparent
235+
# random dots in data space, and overlays a semi-transparent
237236
# :class:`~matplotlib.patches.Circle` centered in the middle of the axes
238237
# with a radius one quarter of the axes -- if your axes does not
239238
# preserve aspect ratio (see :meth:`~matplotlib.axes.Axes.set_aspect`),
240239
# this will look like an ellipse. Use the pan/zoom tool to move around,
241240
# or manually change the data xlim and ylim, and you will see the data
242-
# move, but the circle will remain fixed because it is not in `data`
241+
# move, but the circle will remain fixed because it is not in *data*
243242
# coordinates and will always remain at the center of the axes.
244243

245244
fig, ax = plt.subplots()
@@ -257,7 +256,7 @@
257256
# Blended transformations
258257
# =======================
259258
#
260-
# Drawing in `blended` coordinate spaces which mix `axes` with `data`
259+
# Drawing in *blended* coordinate spaces which mix *axes* with *data*
261260
# coordinates is extremely useful, for example to create a horizontal
262261
# span which highlights some region of the y-data but spans across the
263262
# x-axis regardless of the data limits, pan or zoom level, etc. In fact
@@ -300,7 +299,7 @@
300299
###############################################################################
301300
# .. note::
302301
#
303-
# The blended transformations where x is in data coords and y in axes
302+
# The blended transformations where x is in *data* coords and y in *axes*
304303
# coordinates is so useful that we have helper methods to return the
305304
# versions Matplotlib uses internally for drawing ticks, ticklabels, etc.
306305
# The methods are :meth:`matplotlib.axes.Axes.get_xaxis_transform` and
@@ -357,14 +356,14 @@
357356
#
358357
# trans = ScaledTranslation(xt, yt, scale_trans)
359358
#
360-
# where `xt` and `yt` are the translation offsets, and `scale_trans` is
361-
# a transformation which scales `xt` and `yt` at transformation time
359+
# where *xt* and *yt* are the translation offsets, and *scale_trans* is
360+
# a transformation which scales *xt* and *yt* at transformation time
362361
# before applying the offsets.
363362
#
364363
# Note the use of the plus operator on the transforms below.
365364
# This code says: first apply the scale transformation ``fig.dpi_scale_trans``
366365
# to make the ellipse the proper size, but still centered at (0, 0),
367-
# and then translate the data to `xdata[0]` and `ydata[0]` in data space.
366+
# and then translate the data to ``xdata[0]`` and ``ydata[0]`` in data space.
368367
#
369368
# In interactive use, the ellipse stays the same size even if the
370369
# axes limits are changed via zoom.
@@ -392,7 +391,7 @@
392391
# in data space to the correct spot.
393392
# If we had done the ``ScaledTranslation`` first, then
394393
# ``xdata[0]`` and ``ydata[0]`` would
395-
# first be transformed to ``display`` coordinates (``[ 358.4 475.2]`` on
394+
# first be transformed to *display* coordinates (``[ 358.4 475.2]`` on
396395
# a 200-dpi monitor) and then those coordinates
397396
# would be scaled by ``fig.dpi_scale_trans`` pushing the center of
398397
# the ellipse well off the screen (i.e. ``[ 71680. 95040.]``).
@@ -406,7 +405,7 @@
406405
# a new transformation that is
407406
# offset from another transformation, e.g., to place one object shifted a
408407
# bit relative to another object. Typically you want the shift to be in
409-
# some physical dimension, like points or inches rather than in data
408+
# some physical dimension, like points or inches rather than in *data*
410409
# coordinates, so that the shift effect is constant at different zoom
411410
# levels and dpi settings.
412411
#
@@ -418,8 +417,8 @@
418417
# Here we apply the transforms in the *opposite* order to the use of
419418
# :class:`~matplotlib.transforms.ScaledTranslation` above. The plot is
420419
# first made in data units (``ax.transData``) and then shifted by
421-
# ``dx`` and ``dy`` points using `fig.dpi_scale_trans`. (In typography,
422-
# a`point <https://en.wikipedia.org/wiki/Point_%28typography%29>`_ is
420+
# ``dx`` and ``dy`` points using ``fig.dpi_scale_trans``. (In typography,
421+
# a `point <https://en.wikipedia.org/wiki/Point_%28typography%29>`_ is
423422
# 1/72 inches, and by specifying your offsets in points, your figure
424423
# will look the same regardless of the dpi resolution it is saved in.)
425424

@@ -464,7 +463,7 @@
464463
#
465464
# The ``ax.transData`` transform we have been working with in this
466465
# tutorial is a composite of three different transformations that
467-
# comprise the transformation pipeline from `data` -> `display`
466+
# comprise the transformation pipeline from *data* -> *display*
468467
# coordinates. Michael Droettboom implemented the transformations
469468
# framework, taking care to provide a clean API that segregated the
470469
# nonlinear projections and scales that happen in polar and logarithmic
@@ -485,11 +484,11 @@
485484
#
486485
# We've been introduced to the ``transAxes`` instance above in
487486
# :ref:`axes-coords`, which maps the (0, 0), (1, 1) corners of the
488-
# axes or subplot bounding box to `display` space, so let's look at
487+
# axes or subplot bounding box to *display* space, so let's look at
489488
# these other two pieces.
490489
#
491490
# ``self.transLimits`` is the transformation that takes you from
492-
# ``data`` to ``axes`` coordinates; i.e., it maps your view xlim and ylim
491+
# *data* to *axes* coordinates; i.e., it maps your view xlim and ylim
493492
# to the unit space of the axes (and ``transAxes`` then takes that unit
494493
# space to display space). We can see this in action here
495494
#
@@ -516,7 +515,7 @@
516515
# Out[87]: array([ 0.5, 0.5])
517516
#
518517
# and we can use this same inverted transformation to go from the unit
519-
# `axes` coordinates back to `data` coordinates.
518+
# *axes* coordinates back to *data* coordinates.
520519
#
521520
# .. sourcecode:: ipython
522521
#

tutorials/colors/colorbar_only.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#
4646
# The second example illustrates the use of a
4747
# :class:`~matplotlib.colors.ListedColormap` which generates a colormap from a
48-
# set of listed colors, :func:`colors.BoundaryNorm` which generates a colormap
48+
# set of listed colors, `.colors.BoundaryNorm` which generates a colormap
4949
# index based on discrete intervals and extended ends to show the "over" and
5050
# "under" value colors. Over and under are used to display data outside of the
5151
# normalized [0, 1] range. Here we pass colors as gray shades as a string

tutorials/colors/colormap-manipulation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# ListedColormap
5050
# --------------
5151
#
52-
# `ListedColormap` s store their color values in a ``.colors`` attribute.
52+
# `.ListedColormap` s store their color values in a ``.colors`` attribute.
5353
# The list of colors that comprise the colormap can be directly accessed using
5454
# the ``colors`` property,
5555
# or it can be accessed indirectly by calling ``viridis`` with an array
@@ -69,7 +69,7 @@
6969
##############################################################################
7070
# LinearSegmentedColormap
7171
# -----------------------
72-
# `LinearSegmentedColormap` s do not have a ``.colors`` attribute.
72+
# `.LinearSegmentedColormap` s do not have a ``.colors`` attribute.
7373
# However, one may still call the colormap with an integer array, or with a
7474
# float array between 0 and 1.
7575

@@ -238,7 +238,7 @@ def plot_linearmap(cdict):
238238
#
239239
# The above described is a very versatile approach, but admitedly a bit
240240
# cumbersome to implement. For some basic cases, the use of
241-
# `LinearSegmentedColormap.from_list` may be easier. This creates a segmented
241+
# `.LinearSegmentedColormap.from_list` may be easier. This creates a segmented
242242
# colormap with equal spacings from a supplied list of colors.
243243

244244
colors = ["darkorange", "gold", "lawngreen", "lightseagreen"]

tutorials/colors/colormapnorms.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@
3535
Logarithmic
3636
-----------
3737
38-
One of the most common transformations is to plot data by taking
39-
its logarithm (to the base-10). This transformation is useful to
40-
display changes across disparate scales. Using :func:`colors.LogNorm`
41-
normalizes the data via :math:`log_{10}`. In the example below,
42-
there are two bumps, one much smaller than the other. Using
43-
:func:`colors.LogNorm`, the shape and location of each bump can clearly
44-
be seen:
38+
One of the most common transformations is to plot data by taking its logarithm
39+
(to the base-10). This transformation is useful to display changes across
40+
disparate scales. Using `.colors.LogNorm` normalizes the data via
41+
:math:`log_{10}`. In the example below, there are two bumps, one much smaller
42+
than the other. Using `.colors.LogNorm`, the shape and location of each bump
43+
can clearly be seen:
4544
"""
4645
import numpy as np
4746
import matplotlib.pyplot as plt
@@ -76,7 +75,7 @@
7675
# Similarly, it sometimes happens that there is data that is positive
7776
# and negative, but we would still like a logarithmic scaling applied to
7877
# both. In this case, the negative numbers are also scaled
79-
# logarithmically, and mapped to smaller numbers; e.g., if `vmin=-vmax`,
78+
# logarithmically, and mapped to smaller numbers; e.g., if ``vmin=-vmax``,
8079
# then they the negative numbers are mapped from 0 to 0.5 and the
8180
# positive from 0.5 to 1.
8281
#
@@ -112,7 +111,7 @@
112111
#
113112
# Sometimes it is useful to remap the colors onto a power-law
114113
# relationship (i.e. :math:`y=x^{\gamma}`, where :math:`\gamma` is the
115-
# power). For this we use the :func:`colors.PowerNorm`. It takes as an
114+
# power). For this we use the `.colors.PowerNorm`. It takes as an
116115
# argument *gamma* (*gamma* == 1.0 will just yield the default linear
117116
# normalization):
118117
#
@@ -142,11 +141,10 @@
142141
# Discrete bounds
143142
# ---------------
144143
#
145-
# Another normaization that comes with Matplotlib is
146-
# :func:`colors.BoundaryNorm`. In addition to *vmin* and *vmax*, this
147-
# takes as arguments boundaries between which data is to be mapped. The
148-
# colors are then linearly distributed between these "bounds". For
149-
# instance:
144+
# Another normalization that comes with Matplotlib is `.colors.BoundaryNorm`.
145+
# In addition to *vmin* and *vmax*, this takes as arguments boundaries between
146+
# which data is to be mapped. The colors are then linearly distributed between
147+
# these "bounds". For instance:
150148
#
151149
# .. ipython::
152150
#

tutorials/colors/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
color cycle): ``{'tab:blue', 'tab:orange', 'tab:green', 'tab:red',
2222
'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'}``
2323
(case-insensitive);
24-
* a "CN" color spec, i.e. `'C'` followed by a number, which is an index into
24+
* a "CN" color spec, i.e. ``'C'`` followed by a number, which is an index into
2525
the default property cycle (``matplotlib.rcParams['axes.prop_cycle']``); the
2626
indexing is intended to occur at rendering time, and defaults to black if the
2727
cycle does not include color.

tutorials/intermediate/constrainedlayout_guide.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def example_plot(ax, fontsize=12, nodec=False):
335335
# ========
336336
#
337337
# There are five :ref:`rcParams<matplotlib-rcparams>` that can be set,
338-
# either in a script or in the `matplotlibrc` file.
338+
# either in a script or in the :file:`matplotlibrc` file.
339339
# They all have the prefix ``figure.constrained_layout``:
340340
#
341341
# - ``use``: Whether to use constrained_layout. Default is False
@@ -504,8 +504,8 @@ def docomplicated(suptitle=None):
504504
# ----------------------
505505
#
506506
# ``constrained_layout`` will not work on subplots
507-
# created via the `subplot` command. The reason is that each of these
508-
# commands creates a separate `GridSpec` instance and ``constrained_layout``
507+
# created via the `.pyplot.subplot` command. The reason is that each of these
508+
# commands creates a separate `.GridSpec` instance and ``constrained_layout``
509509
# uses (nested) gridspecs to carry out the layout. So the following fails
510510
# to yield a nice layout:
511511

tutorials/intermediate/gridspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Perhaps the primary function used to create figures and axes.
1010
It's also similar to :func:`.matplotlib.pyplot.subplot`,
1111
but creates and places all axes on the figure at once. See also
12-
`matplotlib.Figure.subplots`.
12+
`matplotlib.figure.Figure.subplots`.
1313
1414
:class:`~matplotlib.gridspec.GridSpec`
1515
Specifies the geometry of the grid that a subplot will be

0 commit comments

Comments
 (0)