8000 Merge pull request #20528 from anntzer/sd · matplotlib/matplotlib@5793748 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5793748

Browse files
authored
Merge pull request #20528 from anntzer/sd
Merge subplot_demo into subplot example.
2 parents 6abaf1f + 3388f54 commit 5793748

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 13 additions & 20 deletions
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

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

tutorials/introductory/pyplot.py

Lines changed: 1 addition & 2 deletions
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)
0