Skip to content

Commit 3388f54

Browse files
committed
Merge subplot_demo into subplot example.
The contents are nearly the same as the first example in subplot.py, except for the sharey'ing (but that's not discussed at all in subplot_demo.py, and is anyways described more in depth in subplots_demo.py)
1 parent d385b2c commit 3388f54

File tree

4 files changed

+15
-52
lines changed

4 files changed

+15
-52
lines changed

doc/users/prev_whats_new/whats_new_1.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ indexing (starts with 0). e.g.::
4444
fig, axarr = plt.subplots(2, 2)
4545
axarr[0,0].plot([1,2,3]) # upper, left
4646

47-
See :doc:`/gallery/subplots_axes_and_figures/subplot_demo` for several code examples.
47+
See :doc:`/gallery/subplots_axes_and_figures/subplot` for several code examples.
4848

4949
Contour fixes and and triplot
5050
-----------------------------

examples/subplots_axes_and_figures/subplot.py

+13-20
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@
44
=================
55
66
Simple demo with multiple subplots.
7+
8+
For more options, see :doc:`/gallery/subplots_axes_and_figures/subplots_demo`.
9+
10+
.. redirect-from:: /gallery/subplots_axes_and_figures/subplot_demo
711
"""
12+
813
import numpy as np
914
import matplotlib.pyplot as plt
1015

11-
###############################################################################
12-
16+
# Create some fake data.
1317
x1 = np.linspace(0.0, 5.0)
14-
x2 = np.linspace(0.0, 2.0)
15-
1618
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
19+
x2 = np.linspace(0.0, 2.0)
1720
y2 = np.cos(2 * np.pi * x2)
1821

22+
###############################################################################
23+
# `~.pyplot.subplots()` is the recommended method to generate simple subplot
24+
# arrangements:
25+
1926
fig, (ax1, ax2) = plt.subplots(2, 1)
2027
fig.suptitle('A tale of 2 subplots')
2128

@@ -28,22 +35,8 @@
2835

2936
plt.show()
3037

31-
#############################################################################
32-
#
33-
#
34-
# Alternative Method For Creating Multiple Plots
35-
# """"""""""""""""""""""""""""""""""""""""""""""
36-
#
37-
# Subplots can also be generated using `~.pyplot.subplot()` \
38-
# as in the following example:
39-
#
40-
41-
42-
x1 = np.linspace(0.0, 5.0)
43-
x2 = np.linspace(0.0, 2.0)
44-
45-
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
46-
y2 = np.cos(2 * np.pi * x2)
38+
###############################################################################
39+
# Subplots can also be generated one at a time using `~.pyplot.subplot()`:
4740

4841
plt.subplot(2, 1, 1)
4942
plt.plot(x1, y1, 'o-')

examples/subplots_axes_and_figures/subplot_demo.py

-29
This file was deleted.

tutorials/introductory/pyplot.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,9 @@ def f(t):
273273
# which allows you to specify the location as ``axes([left, bottom,
274274
# width, height])`` where all values are in fractional (0 to 1)
275275
# coordinates. See :doc:`/gallery/subplots_axes_and_figures/axes_demo` for an example of
276-
# placing axes manually and :doc:`/gallery/subplots_axes_and_figures/subplot_demo` for an
276+
# placing axes manually and :doc:`/gallery/subplots_axes_and_figures/subplot` for an
277277
# example with lots of subplots.
278278
#
279-
#
280279
# You can create multiple figures by using multiple
281280
# `~.pyplot.figure` calls with an increasing figure
282281
# number. Of course, each figure can contain as many axes and subplots

0 commit comments

Comments
 (0)