Skip to content

Commit 6383e43

Browse files
authored
Merge pull request #23605 from oscargus/examplesanddocs
Fix issues in examples, docs, and tutorials
2 parents ecba9d2 + 137ebfa commit 6383e43

File tree

10 files changed

+50
-36
lines changed

10 files changed

+50
-36
lines changed

doc/api/artist_api.rst

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Interactive
2727
-----------
2828

2929
.. autosummary::
30+
:template: autosummary.rst
3031
:toctree: _as_gen
3132
:nosignatures:
3233

@@ -48,6 +49,7 @@ Clipping
4849
--------
4950

5051
.. autosummary::
52+
:template: autosummary.rst
5153
:toctree: _as_gen
5254
:nosignatures:
5355

@@ -62,6 +64,7 @@ Bulk Properties
6264
---------------
6365

6466
.. autosummary::
67+
:template: autosummary.rst
6568
:toctree: _as_gen
6669
:nosignatures:
6770

@@ -74,6 +77,7 @@ Drawing
7477
-------
7578

7679
.. autosummary::
80+
:template: autosummary.rst
7781
:toctree: _as_gen
7882
:nosignatures:
7983

@@ -107,6 +111,7 @@ Figure and Axes
107111
---------------
108112

109113
.. autosummary::
114+
:template: autosummary.rst
110115
:toctree: _as_gen
111116
:nosignatures:
112117

@@ -121,6 +126,7 @@ Children
121126
--------
122127

123128
.. autosummary::
129+
:template: autosummary.rst
124130
:toctree: _as_gen
125131
:nosignatures:
126132

@@ -131,6 +137,7 @@ Transform
131137
---------
132138

133139
.. autosummary::
140+
:template: autosummary.rst
134141
:toctree: _as_gen
135142
:nosignatures:
136143

@@ -142,6 +149,7 @@ Units
142149
-----
143150

144151
.. autosummary::
152+
:template: autosummary.rst
145153
:toctree: _as_gen
146154
:nosignatures:
147155

@@ -153,6 +161,7 @@ Metadata
153161
--------
154162

155163
.. autosummary::
164+
:template: autosummary.rst
156165
:toctree: _as_gen
157166
:nosignatures:
158167

@@ -167,6 +176,7 @@ Miscellaneous
167176
-------------
168177

169178
.. autosummary::
179+
:template: autosummary.rst
170180
:toctree: _as_gen
171181
:nosignatures:
172182

@@ -179,6 +189,7 @@ Functions
179189
=========
180190

181191
.. autosummary::
192+
:template: autosummary.rst
182193
:toctree: _as_gen
183194
:nosignatures:
184195

doc/users/installing/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ at the Terminal.app command line::
304304

305305
You should see something like ::
306306

307-
3.0.0 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/__init__.py
307+
3.6.0 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/__init__.py
308308

309-
where ``3.0.0`` is the Matplotlib version you just installed, and the path
309+
where ``3.6.0`` is the Matplotlib version you just installed, and the path
310310
following depends on whether you are using Python.org Python, Homebrew or
311311
Macports. If you see another version, or you get an error like ::
312312

examples/lines_bars_and_markers/linestyles.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
Simple linestyles can be defined using the strings "solid", "dotted", "dashed"
77
or "dashdot". More refined control can be achieved by providing a dash tuple
88
``(offset, (on_off_seq))``. For example, ``(0, (3, 10, 1, 15))`` means
9-
(3pt line, 10pt space, 1pt line, 15pt space) with no offset. See also
10-
`.Line2D.set_linestyle`.
9+
(3pt line, 10pt space, 1pt line, 15pt space) with no offset, while
10+
``(5, (10, 3))``, means (10pt line, 3pt space), but skip the first 5pt line.
11+
See also `.Line2D.set_linestyle`.
1112
1213
*Note*: The dash style can also be configured via `.Line2D.set_dashes`
1314
as shown in :doc:`/gallery/lines_bars_and_markers/line_demo_dash_control`
@@ -27,7 +28,7 @@
2728
('loosely dotted', (0, (1, 10))),
2829
('dotted', (0, (1, 1))),
2930
('densely dotted', (0, (1, 1))),
30-
31+
('long dash with offset', (5, (10, 3))),
3132
('loosely dashed', (0, (5, 10))),
3233
('dashed', (0, (5, 5))),
3334
('densely dashed', (0, (5, 1))),

examples/ticks/centered_ticklabels.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'center', 'left', or 'right' can be controlled using the horizontal alignment
88
property::
99
10-
for label in ax.xaxis.get_xticklabels():
10+
for label in ax.get_xticklabels():
1111
label.set_horizontalalignment('right')
1212
1313
However there is no direct way to center the labels between ticks. To fake
@@ -23,7 +23,7 @@
2323
import matplotlib.ticker as ticker
2424
import matplotlib.pyplot as plt
2525

26-
# load some financial data; Google's stock price
26+
# Load some financial data; Google's stock price
2727
r = (cbook.get_sample_data('goog.npz', np_load=True)['price_data']
2828
.view(np.recarray))
2929
r = r[-250:] # get the last 250 days
@@ -38,11 +38,12 @@
3838
ax.xaxis.set_major_formatter(ticker.NullFormatter())
3939
ax.xaxis.set_minor_formatter(dates.DateFormatter('%b'))
4040

41-
for tick in ax.xaxis.get_minor_ticks():
42-
tick.tick1line.set_markersize(0)
43-
tick.tick2line.set_markersize(0)
44-
tick.label1.set_horizontalalignment('center')
41+
# Remove the tick lines
42+
ax.tick_params(axis='x', which='minor', tick1On=False, tick2On=False)
4543

44+
# Align the minor tick label
45+
for label in ax.get_xticklabels(minor=True):
46+
label.set_horizontalalignment('center')
4647
imid = len(r) // 2
4748
ax.set_xlabel(str(r.date[imid].item().year))
4849
plt.show()

lib/matplotlib/mpl-data/matplotlibrc

+8-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
## $HOME/.matplotlib/matplotlibrc
2020
## and edit that copy.
2121
##
22-
## See https://matplotlib.org/users/customizing.html#the-matplotlibrc-file
22+
## See https://matplotlib.org/stable/tutorials/introductory/customizing.html#customizing-with-matplotlibrc-files
2323
## for more details on the paths which are checked for the configuration file.
2424
##
2525
## Blank lines, or lines starting with a comment symbol, are ignored, as are
@@ -218,9 +218,9 @@
218218
## on font properties. The 6 font properties used for font matching are
219219
## given below with their default values.
220220
##
221-
## The font.family property can take either a concrete font name (not supported
222-
## when rendering text with usetex), or one of the following five generic
223-
## values:
221+
## The font.family property can take either a single or multiple entries of any
222+
## combination of concrete font names (not supported when rendering text with
223+
## usetex) or the following five generic values:
224224
## - 'serif' (e.g., Times),
225225
## - 'sans-serif' (e.g., Helvetica),
226226
## - 'cursive' (e.g., Zapf-Chancery),
@@ -738,9 +738,10 @@
738738
## * INTERACTIVE KEYMAPS *
739739
## ***************************************************************************
740740
## Event keys to interact with figures/plots via keyboard.
741-
## See https://matplotlib.org/users/navigation_toolbar.html for more details on
742-
## interactive navigation. Customize these settings according to your needs.
743-
## Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '')
741+
## See https://matplotlib.org/stable/users/explain/interactive.html for more
742+
## details on interactive navigation. Customize these settings according to
743+
## your needs. Leave the field(s) empty if you don't need a key-map. (i.e.,
744+
## fullscreen : '')
744745
#keymap.fullscreen: f, ctrl+f # toggling
745746
#keymap.home: h, r, home # home or reset mnemonic
746747
#keymap.back: left, c, backspace, MouseButton.BACK # forward / backward keys

lib/matplotlib/tri/triangulation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def edges(self):
104104
Return integer array of shape (nedges, 2) containing all edges of
105105
non-masked triangles.
106106
107-
Each row defines an edge by it's start point index and end point
107+
Each row defines an edge by its start point index and end point
108108
index. Each edge appears only once, i.e. for an edge between points
109109
*i* and *j*, there will only be either *(i, j)* or *(j, i)*.
110110
"""
@@ -126,7 +126,7 @@ def get_cpp_triangulation(self):
126126

127127
def get_masked_triangles(self):
128128
"""
129-
Return an array of triangles that are not masked.
129+
Return an array of triangles taking the mask into account.
130130
"""
131131
if self.mask is not None:
132132
return self.triangles[~self.mask]

lib/matplotlib/tri/tricontour.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _contour_args(self, args, kwargs):
129129
The colors of the levels, i.e., the contour %%(type)s.
130130
131131
The sequence is cycled for the levels in ascending order. If the sequence
132-
is shorter than the number of levels, it's repeated.
132+
is shorter than the number of levels, it is repeated.
133133
134134
As a shortcut, single color strings may be used in place of one-element
135135
lists, i.e. ``'red'`` instead of ``['red']`` to color all levels with the

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def make_release_tree(self, base_dir, files):
263263
author="John D. Hunter, Michael Droettboom",
264264
author_email="matplotlib-users@python.org",
265265
url="https://matplotlib.org",
266-
download_url="https://matplotlib.org/users/installing.html",
266+
download_url="https://matplotlib.org/stable/users/installing/index.html",
267267
project_urls={
268268
'Documentation': 'https://matplotlib.org',
269269
'Source Code': 'https://github.com/matplotlib/matplotlib',

tutorials/intermediate/artists.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class in the Matplotlib API, and the one you will be working with most
353353
# images A list of `.FigureImage` patches -
354354
# useful for raw pixel display
355355
# legends A list of Figure `.Legend` instances
356-
# (different from ``Axes.legends``)
356+
# (different from ``Axes.get_legend()``)
357357
# lines A list of Figure `.Line2D` instances
358358
# (rarely used, see ``Axes.lines``)
359359
# patches A list of Figure `.Patch`\s
@@ -543,7 +543,7 @@ class in the Matplotlib API, and the one you will be working with most
543543
# `~.axes.Axes.fill` - shared area `.Polygon` ax.patches
544544
# `~.axes.Axes.hist` - histograms `.Rectangle` ax.patches
545545
# `~.axes.Axes.imshow` - image data `.AxesImage` ax.images
546-
# `~.axes.Axes.legend` - Axes legends `.Legend` ax.legends
546+
# `~.axes.Axes.legend` - Axes legend `.Legend` ax.get_legend()
547547
# `~.axes.Axes.plot` - xy plots `.Line2D` ax.lines
548548
# `~.axes.Axes.scatter` - scatter charts `.PolyCollection` ax.collections
549549
# `~.axes.Axes.text` - text `.Text` ax.texts
@@ -563,26 +563,26 @@ class in the Matplotlib API, and the one you will be working with most
563563
# the font color of the ``XAxis`` ticklabels using the ``Axes`` helper
564564
# method::
565565
#
566-
# for label in ax.get_xticklabels():
567-
# label.set_color('orange')
566+
# ax.tick_params(axis='x', labelcolor='orange')
568567
#
569-
# Below is a summary of the Artists that the Axes contains
568+
# Below is a summary of the Artists that the `~.axes.Axes` contains
570569
#
571570
# ============== =========================================
572571
# Axes attribute Description
573572
# ============== =========================================
574-
# artists A list of `.Artist` instances
573+
# artists An `.ArtistList` of `.Artist` instances
575574
# patch `.Rectangle` instance for Axes background
576-
# collections A list of `.Collection` instances
577-
# images A list of `.AxesImage`
578-
# legends A list of `.Legend` instances
579-
# lines A list of `.Line2D` instances
580-
# patches A list of `.Patch` instances
581-
# texts A list of `.Text` instances
575+
# collections An `.ArtistList` of `.Collection` instances
576+
# images An `.ArtistList` of `.AxesImage`
577+
# lines An `.ArtistList` of `.Line2D` instances
578+
# patches An `.ArtistList` of `.Patch` instances
579+
# texts An `.ArtistList` of `.Text` instances
582580
# xaxis A `matplotlib.axis.XAxis` instance
583581
# yaxis A `matplotlib.axis.YAxis` instance
584582
# ============== =========================================
585583
#
584+
# The legend can be accessed by `~.axes.Axes.get_legend`,
585+
#
586586
# .. _axis-container:
587587
#
588588
# Axis containers

tutorials/introductory/customizing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def plotting_function():
217217
#
218218
# 4. :file:`{INSTALL}/matplotlib/mpl-data/matplotlibrc`, where
219219
# :file:`{INSTALL}` is something like
220-
# :file:`/usr/lib/python3.7/site-packages` on Linux, and maybe
221-
# :file:`C:\\Python37\\Lib\\site-packages` on Windows. Every time you
220+
# :file:`/usr/lib/python3.9/site-packages` on Linux, and maybe
221+
# :file:`C:\\Python39\\Lib\\site-packages` on Windows. Every time you
222222
# install matplotlib, this file will be overwritten, so if you want
223223
# your customizations to be saved, please move this file to your
224224
# user-specific matplotlib directory.

0 commit comments

Comments
 (0)