Skip to content

Navigation Menu

Sign in
Appearance settings

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 2a7c93c

Browse filesBrowse files
authored
Merge pull request #25019 from anntzer/pe
Tweak titles pyplot examples.
2 parents e12b75d + 4b8ef41 commit 2a7c93c
Copy full SHA for 2a7c93c

File tree

Expand file treeCollapse file tree

8 files changed

+39
-65
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+39
-65
lines changed

‎.flake8

Copy file name to clipboardExpand all lines: .flake8
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ per-file-ignores =
8484
tutorials/introductory/quick_start.py: E703
8585
tutorials/introductory/animation_tutorial.py: E501
8686
tutorials/text/annotations.py: E402, E501
87+
tutorials/text/mathtext.py: E501
8788
tutorials/text/text_intro.py: E402
8889
tutorials/text/text_props.py: E501
8990
tutorials/text/usetex.py: E501

‎examples/pyplots/axline.py

Copy file name to clipboardExpand all lines: examples/pyplots/axline.py
+1Lines 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

Copy file name to clipboardExpand all lines: examples/pyplots/pyplot_mathtext.py
-30Lines changed: 0 additions & 30 deletions
This file was deleted.

‎examples/pyplots/pyplot_simple.py

Copy file name to clipboardExpand all lines: examples/pyplots/pyplot_simple.py
+6-6Lines 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

Copy file name to clipboardExpand all lines: examples/pyplots/pyplot_text.py
+19-19Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
"""
2-
===========
3-
Pyplot Text
4-
===========
2+
==============================
3+
Text and mathtext using pyplot
4+
==============================
55
6-
"""
7-
import numpy as np
8-
import matplotlib.pyplot as plt
6+
Set the special text objects `~.pyplot.title`, `~.pyplot.xlabel`, and
7+
`~.pyplot.ylabel` through the dedicated pyplot functions. Additional text
8+
objects can be placed in the axes using `~.pyplot.text`.
99
10-
# Fixing random state for reproducibility
11-
np.random.seed(19680801)
10+
You can use TeX-like mathematical typesetting in all texts; see also
11+
:doc:`/tutorials/text/mathtext`.
1212
13-
mu, sigma = 100, 15
14-
x = mu + sigma * np.random.randn(10000)
13+
.. redirect-from:: /gallery/pyplots/pyplot_mathtext
14+
"""
1515

16-
# the histogram of the data
17-
n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75)
16+
import numpy as np
17+
import matplotlib.pyplot as plt
1818

19+
t = np.arange(0.0, 2.0, 0.01)
20+
s = np.sin(2*np.pi*t)
1921

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)
22+
plt.plot(t, s)
23+
plt.text(0, -1, r'Hello, world!', fontsize=15)
24+
plt.title(r'$\mathcal{A}\sin(\omega t)$', fontsize=20)
25+
plt.xlabel('Time [s]')
26+
plt.ylabel('Voltage [mV]')
2727
plt.show()
2828

2929
#############################################################################

‎examples/pyplots/pyplot_three.py

Copy file name to clipboardExpand all lines: examples/pyplots/pyplot_three.py
+5-4Lines 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+
Multiple lines using pyplot
4+
===========================
55
6-
Plot three line plots in a single call to `~matplotlib.pyplot.plot`.
6+
Plot three datasets 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

Copy file name to clipboardExpand all lines: examples/pyplots/pyplot_two_subplots.py
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""
2-
===================
3-
Pyplot Two Subplots
4-
===================
2+
=========================
3+
Two subplots using pyplot
4+
=========================
55
6-
Create a figure with two subplots with `.pyplot.subplot`.
6+
Create a figure with two subplots using `.pyplot.subplot`.
77
"""
8+
89
import numpy as np
910
import matplotlib.pyplot as plt
1011

‎tutorials/text/mathtext.py

Copy file name to clipboardExpand all lines: tutorials/text/mathtext.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@
354354
-------
355355
Here is an example illustrating many of these features in context.
356356
357-
.. figure:: ../../gallery/pyplots/images/sphx_glr_pyplot_mathtext_001.png
358-
:target: ../../gallery/pyplots/pyplot_mathtext.html
357+
.. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_mathtext_demo_001.png
358+
:target: ../../gallery/text_labels_and_annotations/mathtext_demo.html
359359
:align: center
360360
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.