8000 Merge branch 'main' into 3d_plot_focal_length · matplotlib/matplotlib@de45ae1 · GitHub
[go: up one dir, main page]

Skip to content

Commit de45ae1

Browse files
Merge branch 'main' into 3d_plot_focal_length
2 parents c1e5e0a + 8d7a2b9 commit de45ae1

File tree

130 files changed

+3120
-3252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+3120
-3252
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ commands:
2828
name: Merge with upstream
2929
command: |
3030
if ! git remote -v | grep upstream; then
31-
git remote add upstream git://github.com/matplotlib/matplotlib.git
31+
git remote add upstream https://github.com/matplotlib/matplotlib.git
3232
fi
3333
git fetch upstream
3434
if [[ "$CIRCLE_BRANCH" != "main" ]] && \

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ per-file-ignores =
100100
tutorials/introductory/images.py: E402, E501
101101
tutorials/introductory/pyplot.py: E402, E501
102102
tutorials/introductory/sample_plots.py: E501
103-
tutorials/introductory/usage.py: E703
103+
tutorials/introductory/quick_start.py: E703
104104
tutorials/text/annotations.py: E402, E501
105105
tutorials/text/text_intro.py: E402
106106
tutorials/text/text_props.py: E501

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99

1010
env:
1111
NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test.
12-
NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX"
1312
OPENBLAS_NUM_THREADS: 1
1413
PYTHONFAULTHANDLER: 1
1514

@@ -44,7 +43,7 @@ jobs:
4443
extra-requirements: '-r requirements/testing/extra.txt'
4544
XVFB_RUN: xvfb-run -a
4645
- os: ubuntu-20.04
47-
python-version: '3.10-dev'
46+
python-version: '3.10'
4847
# Re-add this when extra dependencies have wheels.
4948
# extra-requirements: '-r requirements/testing/extra.txt'
5049
XVFB_RUN: xvfb-run -a

azure-pipelines.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ stages:
129129
displayName: 'print env'
130130

131131
- bash: |
132-
export NPY_DISABLE_CPU_FEATURES="AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX"
133132
PYTHONFAULTHANDLER=1 python -m pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 ||
134133
[[ "$PYTHON_VERSION" = 'Pre' ]]
135134
displayName: 'pytest'

doc/api/mathtext_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
:members:
1010
:undoc-members:
1111
:show-inheritance:
12-
:exclude-members: Box, Char, ComputerModernFontConstants, DejaVuSansFontConstants, DejaVuSerifFontConstants, FontConstantsBase, Fonts, Glue, Kern, Node, Parser, STIXFontConstants, STIXSansFontConstants, Ship, StandardPsFonts, TruetypeFonts
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``FigureFrameWx.sizer``
2+
~~~~~~~~~~~~~~~~~~~~~~~
3+
... has been removed. The frame layout is no longer based on a sizer, as the
4+
canvas is now the sole child widget; the toolbar is now a regular toolbar
5+
added using ``SetToolBar``.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Move Axes title to not overlap with y axis offset
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Previously, Axes titles could overlap the y-axis offset text, which is often
5+
in the upper left corner of the axes. Now titles are moved above the offset
6+
text if overlapping, and autopositioning is in effect (i.e. if *y* in
7+
`.Axes.set_title` is *None* and :rc:`axes.titley` is also *None*).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``transOffset`` parameter name
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The ``transOffset`` parameter of `.Collection.set_offset_transform` and the
4+
various ``create_collection`` methods of legend handlers has been renamed to
5+
``offset_transform`` (consistently with the property name).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``Axes3D.dist``
2+
~~~~~~~~~~~~~~~
3+
... has been privatized. Use the ``zoom`` keyword argument in
4+
`.Axes3D.set_box_aspect` instead.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
``axes_grid`` and ``axisartist`` removals
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The following deprecated APIs have been removed:
5+
6+
- ``SubplotDivider.figbox``, ``SubplotDivider.update_params``,
7+
- ``SubplotDivider.get_geometry`` (use ``get_subplotspec`` instead),
8+
- ``change_geometry`` (use ``set_subplotspec`` instead),
9+
- ``ParasiteAxesBase.update_viewlim`` (use ``apply_aspect`` instead),
10+
- ``ParasiteAxesAuxTransBase`` (use ``ParasiteAxesBase`` instead),
11+
- ``parasite_axes_auxtrans_class_factory`` (use ``parasite_axes_class_factory``
12+
instead),
13+
- ``ParasiteAxesAuxTrans`` (use ``ParasiteAxes`` instead),
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``Axes.get_window_extent`` and ``Figure.get_window_extent`` won't accept parameters other than *renderer* anymore
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
This aligns the API with the general `.Artist.get_window_extent` API.
4+
All parameters were ignored anyway.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Modules ``tight_bbox`` and ``tight_layout`` deprecated
2+
------------------------------------------------------
3+
4+
The modules ``matplotlib.tight_bbox`` and ``matplotlib.tight_layout`` are
5+
considered internal and public access is deprecated.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Removal of mplot3d deprecations
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The deprecated ``renderer`` arguments have been removed from:
4+
5+
- `.Line3DCollection.do_3d_projection`
6+
- `.Patch3D.do_3d_projection`
7+
- `.PathPatch3D.do_3d_projection`
8+
- `.Path3DCollection.do_3d_projection`
9+
- `.Patch3DCollection.do_3d_projection`
10+
- `.Poly3DCollection.do_3d_projection`
11+
12+
The deprecated ``project`` argument has also been removed from
13+
``Line3DCollection.draw()``.
14+
15+
Passing arguments not specifically listed in the signatures of
16+
`.Axes3D.plot_surface` and `.Axes3D.plot_wireframe` is no longer supported.
17+
Pass any extra arguments as keyword arguments instead.
18+
19+
These properties of the 3D Axes that were placed on the Renderer during draw
20+
have been removed:
21+
22+
* ``renderer.M``
23+
* ``renderer.eye``
24+
* ``renderer.vvec``
25+
* ``renderer.get_axis_position``
26+
27+
These attributes are all available via `.Axes3D`, which can be accessed via
28+
``self.axes`` on all `.Artist`\s.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
colorbar defaults to stealing space from the mappable's axes rather than the current axes
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Pass ``ax=plt.gca()`` to restore the previous behavior.
5+
6+
Removal of deprecated ``colorbar`` APIs
7+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
9+
The following deprecated :mod:`.colorbar` APIs have been removed:
10+
``ColorbarPatch`` and ``colorbar_factory`` (use `.Colorbar` instead);
11+
``colorbar_doc``, ``colorbar_kw_doc``, ``make_axes_kw_doc``.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Removal of deprecated ``mathtext`` APIs
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The following `matplotlib.mathtext` APIs have been removed:
5+
- ``Fonts`` and all its subclasses,
6+
- ``FontConstantsBase`` and all its subclasses,
7+
- ``Node`` and all its subclasses,
8+
- ``Ship``, ``ship``,
9+
- ``Error``,
10+
- ``Parser``,
11+
- ``SHRINK_FACTOR``, ``GROW_FACTOR``,
12+
- ``NUM_SIZE_LEVELS``,
13+
- ``latex_to_bakoma``, ``latex_to_cmex``, ``latex_to_standard``,
14+
- ``stix_virtual_fonts``,
15+
- ``tex2uni``
16+
17+
Removal of various ``mathtext`` helpers
18+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19+
20+
The following `matplotlib.mathtext` classes:
21+
- ``MathtextBackendPdf``,
22+
- ``MathtextBackendPs``,
23+
- ``MathtextBackendSvg``,
24+
- ``MathtextBackendCairo``,
25+
and the ``.mathtext_parser`` attributes on
26+
- `.RendererPdf`,
27+
- `.RendererPS`,
28+
- `.RendererSVG`,
29+
- `.RendererCairo`
30+
have been removed. The `.MathtextBackendPath` class can be used instead.
31+
32+
The methods ``get_depth``, ``parse``, ``to_mask``, ``to_rgba``, and ``to_png``
33+
of `.MathTextParser` have been removed. Use `.mathtext.math_to_image` instead.
34+
35+
The unused ``StandardPsFonts.pswriter`` has been removed.
36+
37+
``ps.useafm`` removed for ``mathtext``
38+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39+
40+
The setting :rc:`ps.useafm` no longer has any effect on `matplotlib.mathtext`.

doc/api/prev_api_changes/api_changes_1.4.x.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ original location:
149149
``drawRect`` from ``FigureCanvasQTAgg``; they were always an
150150
implementation detail of the (preserved) ``drawRectangle()`` function.
151151

152-
* The function signatures of `.tight_bbox.adjust_bbox` and
153-
`.tight_bbox.process_figure_for_rasterizing` have been changed. A new
154-
*fixed_dpi* parameter allows for overriding the ``figure.dpi`` setting
152+
* The function signatures of ``matplotlib.tight_bbox.adjust_bbox`` and
153+
``matplotlib.tight_bbox.process_figure_for_rasterizing`` have been changed.
154+
A new *fixed_dpi* parameter allows for overriding the ``figure.dpi`` setting
155155
instead of trying to deduce the intended behaviour from the file format.
156156

157157
* Added support for horizontal/vertical axes padding to

doc/api/prev_api_changes/api_changes_2.2.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ If `.MovieWriterRegistry` can't find the requested `.MovieWriter`, a
159159
more helpful `RuntimeError` message is now raised instead 10000 of the
160160
previously raised `KeyError`.
161161

162-
`~.tight_layout.auto_adjust_subplotpars` now raises `ValueError`
162+
``matplotlib.tight_layout.auto_adjust_subplotpars`` now raises `ValueError`
163163
instead of `RuntimeError` when sizes of input lists don't match
164164

165165

doc/api/prev_api_changes/api_changes_3.0.1.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
API Changes for 3.0.1
22
=====================
33

4-
`.tight_layout.auto_adjust_subplotpars` can return ``None`` now if the new
5-
subplotparams will collapse axes to zero width or height. This prevents
6-
``tight_layout`` from being executed. Similarly
7-
`.tight_layout.get_tight_layout_figure` will return None.
4+
``matplotlib.tight_layout.auto_adjust_subplotpars`` can return ``None`` now if
5+
the new subplotparams will collapse axes to zero width or height.
6+
This prevents ``tight_layout`` from being executed. Similarly
7+
``matplotlib.tight_layout.get_tight_layout_figure`` will return None.
88

99
To improve import (startup) time, private modules are now imported lazily.
1010
These modules are no longer available at these locations:

doc/api/prev_api_changes/api_changes_3.5.0/behaviour.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ location of values that lie between two levels.
242242
``AxesDivider`` now defaults to rcParams-specified pads
243243
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
244244

245-
`.AxesDivider.append_axes`, `.AxesDivider.new_horizontal`, and
246-
`.AxesDivider.new_vertical` now default to paddings specified by
245+
`.AxesDivider.append_axes`, ``AxesDivider.new_horizontal``, and
246+
``AxesDivider.new_vertical`` now default to paddings specified by
247247
:rc:`figure.subplot.wspace` and :rc:`figure.subplot.hspace` rather than zero.

doc/devel/contributing.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ Introducing
326326
All these helpers take a first parameter *since*, which should be set to
327327
the next point release, e.g. "3.x".
328328

329+
You can use standard rst cross references in *alternative*.
330+
329331
Expiring
330332
~~~~~~~~
331333

doc/devel/documenting_mpl.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,15 @@ Documents can be linked with the ``:doc:`` directive:
199199
200200
See the :doc:`/users/installing/index`
201201
202-
See the tutorial :doc:`/tutorials/introductory/usage`
202+
See the tutorial :doc:`/tutorials/introductory/quick_start`
203203
204204
See the example :doc:`/gallery/lines_bars_and_markers/simple_plot`
205205
206206
will render as:
207207

208208
See the :doc:`/users/installing/index`
209209

210-
See the tutorial :doc:`/tutorials/introductory/usage`
210+
See the tutorial :doc:`/tutorials/introductory/quick_start`
211211

212212
See the example :doc:`/gallery/lines_bars_and_markers/simple_plot`
213213

@@ -847,7 +847,7 @@ render as comments in :doc:`/gallery/lines_bars_and_markers/simple_plot`.
847847

848848
Tutorials are made with the exact same mechanism, except they are longer, and
849849
typically have more than one comment block (i.e.
850-
:doc:`/tutorials/introductory/usage`). The first comment block
850+
:doc:`/tutorials/introductory/quick_start`). The first comment block
851851
can be the same as the example above. Subsequent blocks of ReST text
852852
are delimited by a line of ``###`` characters:
853853

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Learning resources
4646
Tutorials
4747
^^^^^^^^^
4848

49-
- :doc:`Quick-start guide <tutorials/introductory/usage>`
49+
- :doc:`Quick-start guide <tutorials/introductory/quick_start>`
5050
- :doc:`Plot types <plot_types/index>`
5151
- `Introductory tutorials <../tutorials/index.html#introductory>`_
5252
- :doc:`External learning resources <users/resources/index>`

doc/sphinxext/math_symbol_table.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from docutils.parsers.rst import Directive
22

3-
from matplotlib import mathtext
3+
from matplotlib import _mathtext, _mathtext_data
44

55

66
symbols = [
@@ -103,9 +103,9 @@ def run(state_machine):
103103
def render_symbol(sym):
104104
if sym.startswith("\\"):
105105
sym = sym[1:]
106-
if sym not in {*mathtext.Parser._overunder_functions,
107-
*mathtext.Parser._function_names}:
108-
sym = chr(mathtext.tex2uni[sym])
106+
if sym not in (_mathtext.Parser._overunder_functions |
107+
_mathtext.Parser._function_names):
108+
sym = chr(_mathtext_data.tex2uni[sym])
109109
return f'\\{sym}' if sym in ('\\', '|') else sym
110110

111111
lines = []
@@ -149,7 +149,6 @@ def setup(app):
149149

150150
if __name__ == "__main__":
151151
# Do some verification of the tables
152-
from matplotlib import _mathtext_data
153152

154153
print("SYMBOLS NOT IN STIX:")
155154
all_symbols = {}

doc/users/faq/howto_faq.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,59 @@ How-to
99
.. contents::
1010
:backlinks: none
1111

12+
13+
.. _how-to-too-many-ticks:
14+
15+
Why do I have so many ticks, and/or why are they out of order?
16+
--------------------------------------------------------------
17+
18+
One common cause for unexpected tick behavior is passing a *list of strings
19+
instead of numbers or datetime objects*. This can easily happen without notice
20+
when reading in a comma-delimited text file. Matplotlib treats lists of strings
21+
as *categorical* variables
22+
(:doc:`/gallery/lines_bars_and_markers/categorical_variables`), and by default
23+
puts one tick per category, and plots them in the order in which they are
24+
supplied.
25+
26+
.. plot::
27+
:include-source:
28+
:align: center
29+
30+
import matplotlib.pyplot as plt
31+
import numpy as np
32+
33+
fig, ax = plt.subplots(1, 2, constrained_layout=True, figsize=(6, 2))
34+
35+
ax[0].set_title('Ticks seem out of order / misplaced')
36+
x = ['5', '20', '1', '9'] # strings
37+
y = [5, 20, 1, 9]
38+
ax[0].plot(x, y, 'd')
39+
ax[0].tick_params(axis='x', labelcolor='red', labelsize=14)
40+
41+
ax[1].set_title('Many ticks')
42+
x = [str(xx) for xx in np.arange(100)] # strings
43+
y = np.arange(100)
44+
ax[1].plot(x, y)
45+
ax[1].tick_params(axis='x', labelcolor='red', labelsize=14)
46+
47+
The solution is to convert the list of strings to numbers or
48+
datetime objects (often ``np.asarray(numeric_strings, dtype='float')`` or
49+
``np.asarray(datetime_strings, dtype='datetime64[s]')``).
50+
51+
For more information see :doc:`/gallery/ticks/ticks_too_many`.
52+
53+
.. _howto-determine-artist-extent:
54+
55+
Determine the extent of Artists in the Figure
56+
---------------------------------------------
57+
58+
Sometimes we want to know the extent of an Artist. Matplotlib `.Artist` objects
59+
have a method `.Artist.get_window_extent` that will usually return the extent of
60+
the artist in pixels. However, some artists, in particular text, must be
61+
rendered at least once before their extent is known. Matplotlib supplies
62+
`.Figure.draw_without_rendering`, which should be called before calling
63+
``get_window_extent``.
64+
1265
.. _howto-figure-empty:
1366

1467
Check whether a figure is empty

doc/users/getting_started/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ Here is a minimal example plot:
4444
ax.plot(x, y)
4545
plt.show()
4646

47-
If a plot does not show up please check :ref:`troubleshooting-faq`.
47+
If a plot does not show up please check :ref:`troubleshooting-faq`.
4848

4949
Where to go next
5050
----------------
5151

5252
- Check out :doc:`Plot types </plot_types/index>` to get an overview of the
5353
types of plots you can create with Matplotlib.
5454
- Learn Matplotlib from the ground up in the
55-
:doc:`Quick-start guide </tutorials/introductory/usage>`.
55+
:doc:`Quick-start guide </tutorials/introductory/quick_start>`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
``math_to_image`` now has a *color* keyword argument
2+
--------------------------------------------------------
3+
4+
To easily support external libraries that rely on the MathText rendering of
5+
Matplotlib to generate equation images, a *color* keyword argument was added
6+
to `~matplotlib.mathtext.math_to_image`.
7+
8+
.. code-block:: python
9+
10+
from matplotlib import mathtext
11+
mathtext.math_to_image('$x^2$', 'filename.png', color='Maroon')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PolygonSelector bounding boxes
2+
------------------------------
3+
`~matplotlib.widgets.PolygonSelector` now has a *draw_bounding_box* argument, which
4+
when set to `True` will draw a bounding box around the polygon once it is
5+
complete. The bounding box can be resized and moved, allowing the points of
6+
the polygon to be easily resized.

0 commit comments

Comments
 (0)
0