8000 Merge remote-tracking branch 'upstream/master' · matplotlib/matplotlib@b27afa3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b27afa3

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 8cbafae + 91af1f4 commit b27afa3

File tree

19 files changed

+534
-246
lines changed

19 files changed

+534
-246
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ apt-run: &apt-install
2626
texlive-xetex \
2727
graphviz \
2828
libgeos-dev \
29+
fonts-crosextra-carlito \
2930
otf-freefont
3031
3132
fonts-run: &fonts-install

doc/_templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h3>{{ _('Navigation') }}</h3>
4040
<li><a href="{{ pathto('index') }}">home</a>|&nbsp;</li>
4141
<li><a href="{{ pathto('gallery/index') }}">examples</a>|&nbsp;</li>
4242
<li><a href="{{ pathto('tutorials/index') }}">tutorials</a>|&nbsp;</li>
43-
<li><a href="{{ pathto('api/api_overview') }}">API</a>|&nbsp;</li>
43+
<li><a href="{{ pathto('api/index') }}">API</a>|&nbsp;</li>
4444
<li><a href="{{ pathto('contents') }}">contents</a> &raquo;</li>
4545

4646
{%- for parent in parents %}

doc/api/api_overview.rst

Lines changed: 0 additions & 55 deletions
This file was deleted.

doc/api/index.rst

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,74 @@
1+
API Overview
2+
============
3+
4+
.. toctree::
5+
:hidden:
6+
7+
api_changes
8+
9+
.. contents:: :local:
10+
11+
See also the :doc:`api_changes`.
12+
13+
Usage patterns
14+
--------------
15+
16+
Below we describe several common approaches to plotting with Matplotlib.
17+
18+
The pyplot API
19+
^^^^^^^^^^^^^^
20+
21+
`matplotlib.pyplot` is a collection of command style functions that make
22+
Matplotlib work like MATLAB. Each pyplot function makes some change to a
23+
figure: e.g., creates a figure, creates a plotting area in a figure, plots
24+
some lines in a plotting area, decorates the plot with labels, etc.
25+
26+
`.pyplot` is mainly intended for interactive plots and simple cases of
27+
programmatic plot generation.
28+
29+
Further reading:
30+
31+
- The `matplotlib.pyplot` function reference
32+
- :doc:`/tutorials/introductory/pyplot`
33+
- :ref:`Pyplot examples <pyplots_examples>`
34+
135
.. _api-index:
236

3-
####################
4-
The Matplotlib API
5-
####################
37+
The object-oriented API
38+
^^^^^^^^^^^^^^^^^^^^^^^
639

7-
.. toctree::
8-
:maxdepth: 1
40+
At its core, Matplotlib is object-oriented. We recommend directly working
41+
with the objects, if you need more control and customization of your plots.
42+
43+
In many cases you will create a `.Figure` and one or more
44+
`~matplotlib.axes.Axes` using `.pyplot.subplots` and from then on only work
45+
on these objects. However, it's also possible to create `.Figure`\ s
46+
explicitly (e.g. when including them in GUI applications).
947

10-
api_overview.rst
11-
api_changes.rst
48+
Further reading:
1249

50+
- `matplotlib.axes.Axes` and `matplotlib.figure.Figure` for an overview of
51+
plotting functions.
52+
- Most of the :ref:`examples <examples-index>` use the object-oriented approach
53+
(except for the pyplot section)
54+
55+
The pylab API (disapproved)
56+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
57+
58+
.. warning::
59+
Since heavily importing into the global namespace may result in unexpected
60+
behavior, the use of pylab is strongly discouraged. Use `matplotlib.pyplot`
61+
instead.
62+
63+
`pylab` is a module that includes `matplotlib.pyplot`, `numpy`
64+
and some additional functions within a single namespace. Its original purpose
65+
was to mimic a MATLAB-like way of working by importing all functions into the
66+
global namespace. This is considered bad style nowadays.
1367

1468
Modules
15-
=======
69+
-------
70+
71+
Matplotlib consists of the following submodules:
1672

1773
.. toctree::
1874
:maxdepth: 1
@@ -74,7 +130,10 @@ Modules
74130
widgets_api.rst
75131

76132
Toolkits
77-
========
133+
--------
134+
135+
:ref:`toolkits-index` are collections of application-specific functions that extend
136+
Matplotlib. The following toolkits are included:
78137

79138
.. toctree::
80139
:maxdepth: 1

doc/users/credits.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ Paul Kienzle,
840840
John Porter,
841841
and Jonathon Taylor.
842842

843+
Thanks to Tony Yu for the original logo design.
844+
843845
We also thank all who have reported bugs, commented on
844846
proposed changes, or otherwise contributed to Matplotlib's
845847
development and usefulness.

doc/users/generate_credits.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
John Porter,
5353
and Jonathon Taylor.
5454
55+
Thanks to Tony Yu for the original logo design.
56+
5557
We also thank all who have reported bugs, commented on
5658
proposed changes, or otherwise contributed to Matplotlib's
5759
development and usefulness.

doc/users/history.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,86 @@ Matplotlib's original logo (2003 -- 2008).
125125
plt.axis([1, 1.72, -60, 10])
126126
plt.gca().set_xticklabels([])
127127
plt.gca().set_yticklabels([])
128+
129+
Matplotlib logo (2008 - 2015).
130+
131+
..
132+
This logo was added in 325e47b.
133+
134+
.. plot::
135+
136+
import numpy as np
137+
import matplotlib as mpl
138+
import matplotlib.pyplot as plt
139+
import matplotlib.cm as cm
140+
141+
mpl.rcParams['xtick.labelsize'] = 10
142+
mpl.rcParams['ytick.labelsize'] = 12
143+
mpl.rcParams['axes.edgecolor'] = 'gray'
144+
145+
146+
axalpha = 0.05
147+
figcolor = 'white'
148+
dpi = 80
149+
fig = plt.figure(figsize=(6, 1.1), dpi=dpi)
150+
fig.patch.set_edgecolor(figcolor)
151+
fig.patch.set_facecolor(figcolor)
152+
153+
154+
def add_math_background():
155+
ax = fig.add_axes([0., 0., 1., 1.])
156+
157+
text = []
158+
text.append(
159+
(r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = "
160+
r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}"
161+
r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 "
162+
r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - "
163+
r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} "
164+
r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20))
165+
text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} "
166+
r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$",
167+
(0.35, 0.9), 20))
168+
text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$",
169+
(0.15, 0.3), 25))
170+
text.append((r"$F_G = G\frac{m_1m_2}{r^2}$",
171+
(0.85, 0.7), 30))
172+
for eq, (x, y), size in text:
173+
ax.text(x, y, eq, ha='center', va='center', color="#11557c",
174+
alpha=0.25, transform=ax.transAxes, fontsize=size)
175+
ax.set_axis_off()
176+
return ax
177+
178+
179+
def add_matplotlib_text(ax):
180+
ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65,
181+
ha='right', va='center', alpha=1.0, transform=ax.transAxes)
182+
183+
184+
def add_polar_bar():
185+
ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar')
186+
187+
ax.patch.set_alpha(axalpha)
188+
ax.set_axisbelow(True)
189+
N = 7
190+
arc = 2. * np.pi
191+
theta = np.arange(0.0, arc, arc/N)
192+
radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8])
193+
width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
194+
bars = ax.bar(theta, radii, width=width, bottom=0.0)
195+
for r, bar in zip(radii, bars):
196+
bar.set_facecolor(cm.jet(r/10.))
197+
bar.set_alpha(0.6)
198+
199+
ax.tick_params(labelbottom=False, labeltop=False,
200+
labelleft=False, labelright=False)
201+
202+
ax.grid(lw=0.8, alpha=0.9, ls='-', color='0.5')
203+
204+
ax.set_yticks(np.arange(1, 9, 2))
205+
ax.set_rmax(9)
206+
207+
208+
main_axes = add_math_background()
209+
add_polar_bar()
210+
add_matplotlib_text(main_axes)

0 commit comments

Comments
 (0)
0