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

Skip to content

Commit 1748e33

Browse files
committed
Merge branch 'v3.4.0-doc' into v3.4.x
2 parents 17b3aa0 + f843197 commit 1748e33

File tree

6 files changed

+174
-145
lines changed

6 files changed

+174
-145
lines changed

INSTALL.rst

Lines changed: 47 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
==================
2-
Installation Guide
3-
==================
1+
############
2+
Installation
3+
############
44

5-
.. note::
5+
.. toctree::
6+
:hidden:
67

7-
If you wish to contribute to the project, it's recommended you
8-
:ref:`install the latest development version<install_from_source>`.
8+
installing_source.rst
99

10-
.. contents::
1110

11+
==============================
1212
Installing an official release
1313
==============================
1414

15-
Matplotlib and its dependencies are available as wheel packages for macOS,
16-
Windows and Linux distributions::
15+
Matplotlib releases are available as wheel packages for macOS, Windows and
16+
Linux on `PyPI <https://pypi.org/project/matplotlib/>`_. Install it using
17+
``pip``:
18+
19+
.. code-block:: sh
1720
1821
python -m pip install -U pip
1922
python -m pip install -U matplotlib
@@ -34,114 +37,56 @@ precompiled wheel for your OS and Python.
3437
animations and a larger selection of file formats, you can
3538
install :ref:`optional_dependencies`.
3639

37-
Although not required, we suggest also installing ``IPython`` for
38-
interactive use. To easily install a complete Scientific Python
39-
stack, see :ref:`install_scipy_dists` below.
40-
41-
Third-party distributions of Matplotlib
42-
=======================================
43-
44-
.. _install_scipy_dists:
45-
46-
Scientific Python Distributions
47-
-------------------------------
48-
49-
`Anaconda <https://www.anaconda.com/>`_ and `ActiveState
50-
<https://www.activestate.com/activepython/downloads>`_ are excellent
51-
choices that "just work" out of the box for Windows, macOS and common
52-
Linux platforms. `WinPython <https://winpython.github.io/>`_ is an
53-
option for Windows users. All of these distributions include
54-
Matplotlib and *lots* of other useful (data) science tools.
55-
56-
Linux: using your package manager
57-
---------------------------------
40+
=========================
41+
Third-party distributions
42+
=========================
5843

59-
If you are on Linux, you might prefer to use your package manager. Matplotlib
60-
is packaged for almost every major Linux distribution.
44+
Various third-parties provide Matplotlib for their environments.
6145

62-
* Debian / Ubuntu: ``sudo apt-get install python3-matplotlib``
63-
* Fedora: ``sudo dnf install python3-matplotlib``
64-
* Red Hat: ``sudo yum install python3-matplotlib``
65-
* Arch: ``sudo pacman -S python-matplotlib``
66-
67-
.. _install_from_source:
68-
69-
Installing from source
70-
======================
46+
Conda packages
47+
==============
48+
Matplotlib is available both via the *anaconda main channel*
7149

72-
If you are interested in contributing to Matplotlib development,
73-
running the latest source code, or just like to build everything
74-
yourself, it is not difficult to build Matplotlib from source.
50+
.. code-block:: sh
7551
76-
First you need to install the :ref:`dependencies`.
52+
conda install matplotlib
7753
78-
A C compiler is required. Typically, on Linux, you will need ``gcc``, which
79-
should be installed using your distribution's package manager; on macOS, you
80-
will need xcode_; on Windows, you will need Visual Studio 2015 or later.
54+
as well as via the *conda-forge community channel*
8155

82-
.. _xcode: https://guide.macports.org/chunked/installing.html#installing.xcode
56+
.. code-block:: sh
8357
84-
The easiest way to get the latest development version to start contributing
85-
is to go to the git `repository <https://github.com/matplotlib/matplotlib>`_
86-
and run::
58+
conda install -c conda-forge matplotlib
8759
88-
git clone https://github.com/matplotlib/matplotlib.git
89-
90-
or::
60+
Python distributions
61+
====================
9162

92-
git clone [email protected]:matplotlib/matplotlib.git
63+
Matplotlib is part of major Python distributions:
9364

94-
If you're developing, it's better to do it in editable mode. The reason why
95-
is that pytest's test discovery only works for Matplotlib
96-
if installation is done this way. Also, editable mode allows your code changes
97-
to be instantly propagated to your library code without reinstalling (though
98-
you will have to restart your python process / kernel)::
65+
- `Anaconda <https://www.anaconda.com/>`_
9966

100-
cd matplotlib
101-
python -m pip install -e .
67+
- `ActiveState ActivePython
68+
<https://www.activestate.com/activepython/downloads>`_
10269

103-
If you're not developing, it can be installed from the source directory with
104-
a simple (just replace the last step)::
70+
- `WinPython <https://winpython.github.io/>`_
10571

106-
python -m pip install .
72+
Linux package manager
73+
=====================
10774

108-
To run the tests you will need to install some additional dependencies::
75+
If you are using the Python version that comes with your Linux distribution,
76+
you can install Matplotlib via your package manager, e.g.:
10977

110-
python -m pip install -r requirements/dev/dev-requirements.txt
111-
112-
Then, if you want to update your Matplotlib at any time, just do::
113-
114-
git pull
115-
116-
When you run ``git pull``, if the output shows that only Python files have
117-
been updated, you are all set. If C files have changed, you need to run ``pip
118-
install -e .`` again to compile them.
119-
120-
There is more information on :ref:`using git <using-git>` in the developer
121-
docs.
122-
123-
.. warning::
124-
125-
The following instructions in this section are for very custom
126-
installations of Matplotlib. Proceed with caution because these instructions
127-
may result in your build producing unexpected behavior and/or causing
128-
local testing to fail.
129-
130-
If you would like to build from a tarball, grab the latest *tar.gz* release
131-
file from `the PyPI files page <https://pypi.org/project/matplotlib/>`_.
132-
133-
We provide a `setup.cfg`_ file which you can use to customize the build
134-
process. For example, which default backend to use, whether some of the
135-
optional libraries that Matplotlib ships with are installed, and so on. This
136-
file will be particularly useful to those packaging Matplotlib.
137-
138-
.. _setup.cfg: https://raw.githubusercontent.com/matplotlib/matplotlib/master/setup.cfg.template
78+
* Debian / Ubuntu: ``sudo apt-get install python3-matplotlib``
79+
* Fedora: ``sudo dnf install python3-matplotlib``
80+
* Red Hat: ``sudo yum install python3-matplotlib``
81+
* Arch: ``sudo pacman -S python-matplotlib``
13982

140-
Building on Windows
141-
-------------------
83+
======================
84+
Installing from source
85+
======================
86+
See :ref:`install_from_source`.
14287

143-
Compiling Matplotlib (or any other extension module, for that matter) requires
144-
Visual Studio 2015 or later.
88+
==========================
89+
Installing for development
90+
==========================
91+
See :ref:`installing_for_devs`.
14592

146-
If you are building your own Matplotlib wheels (or sdists), note that any DLLs
147-
that you copy into the source tree will be packaged too.

doc/_static/mpl.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ div.note {
439439
border-color: #ccc;
440440
}
441441

442-
div.seealso {
442+
div.seealso, div.admonition-references {
443443
background-color: #EAF1F7;
444444
border-color: #8EADCC;
445445
color: #3F5E7F;

doc/devel/documenting_mpl.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,35 @@ are delimited by a line of ``###`` characters:
864864
865865
In this way text, code, and figures are output in a "notebook" style.
866866

867+
References for sphinx-gallery
868+
-----------------------------
869+
870+
The showcased Matplotlib functions should be listed in an admonition at the
871+
bottom as follows
872+
873+
.. code-block:: python
874+
875+
###############################################################################
876+
#
877+
# .. admonition:: References
878+
#
879+
# The use of the following functions, methods, classes and modules is shown
880+
# in this example:
881+
#
882+
# - `matplotlib.axes.Axes.fill` / `matplotlib.pyplot.fill`
883+
# - `matplotlib.axes.Axes.axis` / `matplotlib.pyplot.axis`
884+
885+
This allows sphinx-gallery to place an entry to the example in the
886+
mini-gallery of the mentioned functions. Whether or not a function is mentioned
887+
here should be decided depending on if a mini-gallery link prominently helps
888+
to illustrate that function; e.g. mention ``matplotlib.pyplot.subplots`` only
889+
in examples that are about laying out subplots, not in every example that uses
890+
it.
891+
892+
Functions that exist in ``pyplot`` as well as in Axes or Figure should mention
893+
both references no matter which one is used in the example code. The ``pyplot``
894+
reference should always be the second to mention; see the example above.
895+
867896
Order of examples in the gallery
868897
--------------------------------
869898

doc/users/installing_source.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.. _install_from_source:
2+
3+
======================
4+
Installing from source
5+
======================
6+
7+
If you are interested in contributing to Matplotlib development,
8+
running the latest source code, or just like to build everything
9+
yourself, it is not difficult to build Matplotlib from source.
10+
11+
First you need to install the :ref:`dependencies`.
12+
13+
A C compiler is required. Typically, on Linux, you will need ``gcc``, which
14+
should be installed using your distribution's package manager; on macOS, you
15+
will need xcode_; on Windows, you will need Visual Studio 2015 or later.
16+
17+
.. _xcode: https://guide.macports.org/chunked/installing.html#installing.xcode
18+
19+
The easiest way to get the latest development version to start contributing
20+
is to go to the git `repository <https://github.com/matplotlib/matplotlib>`_
21+
and run::
22+
23+
git clone https://github.com/matplotlib/matplotlib.git
24+
25+
or::
26+
27+
git clone [email protected]:matplotlib/matplotlib.git
28+
29+
If you're developing, it's better to do it in editable mode. The reason why
30+
is that pytest's test discovery only works for Matplotlib
31+
if installation is done this way. Also, editable mode allows your code changes
32+
to be instantly propagated to your library code without reinstalling (though
33+
you will have to restart your python process / kernel)::
34+
35+
cd matplotlib
36+
python -m pip install -e .
37+
38+
If you're not developing, it can be installed from the source directory with
39+
a simple (just replace the last step)::
40+
41+
python -m pip install .
42+
43+
To run the tests you will need to install some additional dependencies::
44+
45+
python -m pip install -r requirements/dev/dev-requirements.txt
46+
47+
Then, if you want to update your Matplotlib at any time, just do::
48+
49+
git pull
50+
51+
When you run ``git pull``, if the output shows that only Python files have
52+
been updated, you are all set. If C files have changed, you need to run ``pip
53+
install -e .`` again to compile them.
54+
55+
There is more information on :ref:`using git <using-git>` in the developer
56+
docs.
57+
58+
.. warning::
59+
60+
The following instructions in this section are for very custom
61+
installations of Matplotlib. Proceed with caution because these instructions
62+
may result in your build producing unexpected behavior and/or causing
63+
local testing to fail.
64+
65+
If you would like to build from a tarball, grab the latest *tar.gz* release
66+
file from `the PyPI files page <https://pypi.org/project/matplotlib/>`_.
67+
68+
We provide a `setup.cfg`_ file which you can use to customize the build
69+
process. For example, which default backend to use, whether some of the
70+
optional libraries that Matplotlib ships with are installed, and so on. This
71+
file will be particularly useful to those packaging Matplotlib.
72+
73+
.. _setup.cfg: https://raw.githubusercontent.com/matplotlib/matplotlib/master/setup.cfg.template
74+
75+
If you are building your own Matplotlib wheels (or sdists) on Windows, note
76+
that any DLLs that you copy into the source tree will be packaged too.

examples/lines_bars_and_markers/fill.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,12 @@ def _koch_snowflake_complex(order):
7676

7777
plt.show()
7878

79-
#############################################################################
79+
###############################################################################
8080
#
81-
# ------------
81+
# .. admonition:: References
8282
#
83-
# References
84-
# """"""""""
83+
# The use of the following functions, methods, classes and modules is shown
84+
# in this example:
8585
#
86-
# The use of the following functions, methods, classes and modules is shown
87-
# in this example:
88-
89-
import matplotlib
90-
matplotlib.axes.Axes.fill
91-
matplotlib.pyplot.fill
92-
matplotlib.axes.Axes.axis
93-
matplotlib.pyplot.axis
86+
# - `matplotlib.axes.Axes.fill` / `matplotlib.pyplot.fill`
87+
# - `matplotlib.axes.Axes.axis` / `matplotlib.pyplot.axis`

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,24 @@
11
"""
2-
axis_artist.py module provides axis-related artists. They are
2+
The :mod:`.axis_artist` module implements custom artists to draw axis elements
3+
(axis lines and labels, tick lines and labels, grid lines).
34
4-
* axis line
5-
* tick lines
6-
* tick labels
7-
* axis label
8-
* grid lines
5+
Axis lines and labels and tick lines and labels are managed by the `AxisArtist`
6+
class; grid lines are managed by the `GridlinesCollection` class.
97
10-
The main artist classes are `AxisArtist` and `GridlinesCollection`. While
11-
`GridlinesCollection` is responsible for drawing grid lines, `AxisArtist`
12-
is responsible for all other artists. `AxisArtist` has attributes that are
13-
associated with each type of artists:
8+
There is one `AxisArtist` per Axis; it can be accessed through
9+
the ``axis`` dictionary of the parent Axes (which should be a
10+
`mpl_toolkits.axislines.Axes`), e.g. ``ax.axis["bottom"]``.
1411
15-
* line: axis line
16-
* major_ticks: major tick lines
17-
* major_ticklabels: major tick labels
18-
* minor_ticks: minor tick lines
19-
* minor_ticklabels: minor tick labels
20-
* label: axis label
12+
Children of the AxisArtist are accessed as attributes: ``.line`` and ``.label``
13+
for the axis line and label, ``.major_ticks``, ``.major_ticklabels``,
14+
``.minor_ticks``, ``.minor_ticklabels`` for the tick lines and labels (e.g.
15+
``ax.axis["bottom"].line``).
2116
22-
Typically, the `AxisArtist` associated with an axes will be accessed with the
23-
*axis* dictionary of the axes, i.e., the `AxisArtist` for the bottom axis is ::
17+
Children properties (colors, fonts, line widths, etc.) can be set using
18+
setters, e.g. ::
2419
25-
ax.axis["bottom"]
26-
27-
where *ax* is an instance of `mpl_toolkits.axislines.Axes`. Thus,
28-
``ax.axis["bottom"].line`` is an artist associated with the axis line, and
29-
``ax.axis["bottom"].major_ticks`` is an artist associated with the major tick
30-
lines.
31-
32-
You can change the colors, fonts, line widths, etc. of these artists
33-
by calling suitable set method. For example, to change the color of the major
34-
ticks of the bottom axis to red, use ::
35-
36-
ax.axis["bottom"].major_ticks.set_color("r")
20+
# Make the major ticks of the bottom axis red.
21+
ax.axis["bottom"].major_ticks.set_color("red")
3722
3823
However, things like the locations of ticks, and their ticklabels need to be
3924
changed from the side of the grid_helper.

0 commit comments

Comments
 (0)