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

Skip to content

Commit 236a6ba

Browse files
committed
Tweak titles pyplot examples.
In particular, arrange to not capitalize pyplot. The old titles were not particularly great (and likely derived automatically from the filename back when the move to s-g was done). Also merge the pyplot_text and pyplot_mathtext examples (both examples actually show both text and mathtext).
1 parent f5ff5d7 commit 236a6ba

File tree

6 files changed

+28
-62
lines changed

6 files changed

+28
-62
lines changed

examples/pyplots/axline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1111
`~.axes.Axes.axline` draws infinite straight lines in arbitrary directions.
1212
"""
13+
1314
import numpy as np
1415
import matplotlib.pyplot as plt
1516

examples/pyplots/pyplot_mathtext.py

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

examples/pyplots/pyplot_simple.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"""
2-
=============
3-
Pyplot Simple
4-
=============
2+
===========
3+
Simple plot
4+
===========
55
6-
A very simple pyplot where a list of numbers are plotted against their
7-
index. Creates a straight line due to the rate of change being 1 for
8-
both the X and Y axis. Use a format string (here, 'o-r') to set the
6+
A simple plot where a list of numbers are plotted against their index,
7+
resulting in a straight line. Use a format string (here, 'o-r') to set the
98
markers (circles), linestyle (solid line) and color (red).
109
1110
.. redirect-from:: /gallery/pyplots/fig_axes_labels_simple
1211
.. redirect-from:: /gallery/pyplots/pyplot_formatstr
1312
"""
13+
1414
import matplotlib.pyplot as plt
1515

1616
plt.plot([1, 2, 3, 4], 'o-r')

examples/pyplots/pyplot_text.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
"""
2-
===========
3-
Pyplot Text
4-
===========
2+
=============================
3+
Text and mathtext with pyplot
4+
=============================
55
6+
.. redirect-from:: /gallery/pyplots/pyplot_mathtext
67
"""
8+
79
import numpy as np
810
import matplotlib.pyplot as plt
911

10-
# Fixing random state for reproducibility
11-
np.random.seed(19680801)
12-
13-
mu, sigma = 100, 15
14-
x = mu + sigma * np.random.randn(10000)
15-
16-
# the histogram of the data
17-
n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75)
18-
12+
t = np.arange(0.0, 2.0, 0.01)
13+
s = np.sin(2*np.pi*t)
1914

20-
plt.xlabel('Smarts')
21-
plt.ylabel('Probability')
22-
plt.title('Histogram of IQ')
23-
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
24-
plt.xlim(40, 160)
25-
plt.ylim(0, 0.03)
26-
plt.grid(True)
15+
plt.plot(t, s)
16+
plt.text(0, -1, r'Hello, world!', fontsize=15)
17+
plt.title(r'$\mathcal{A}\sin(\omega t)$', fontsize=20)
18+
plt.xlabel('Time [s]')
19+
plt.ylabel('Voltage [mV]')
2720
plt.show()
2821

2922
#############################################################################

examples/pyplots/pyplot_three.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""
2-
============
3-
Pyplot Three
4-
============
2+
=======================
3+
Three lines with pyplot
4+
=======================
55
6-
Plot three line plots in a single call to `~matplotlib.pyplot.plot`.
6+
Make three line plots with a single call to `~matplotlib.pyplot.plot`.
77
"""
8+
89
import numpy as np
910
import matplotlib.pyplot as plt
1011

examples/pyplots/pyplot_two_subplots.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""
2-
===================
3-
Pyplot Two Subplots
4-
===================
2+
========================
3+
Two subplots with pyplot
4+
========================
55
66
Create a figure with two subplots with `.pyplot.subplot`.
77
"""
8+
89
import numpy as np
910
import matplotlib.pyplot as plt
1011

0 commit comments

Comments
 (0)