8000 Merge pull request #16841 from timhoffm/errorbar-subsample · matplotlib/matplotlib@6cc84e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6cc84e9

Browse files
authored
Merge pull request #16841 from timhoffm/errorbar-subsample
Cleanup errorbar subsampling example
2 parents 8badcec + 241668a commit 6cc84e9

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""
2-
==================
3-
Errorbar Subsample
4-
==================
2+
====================
3+
Errorbar subsampling
4+
====================
55
6-
Demo for the errorevery keyword to show data full accuracy data plots with
7-
few errorbars.
6+
The parameter *errorevery* of `.Axes.errorbar` can be used to draw error bars
7+
only on a subset of data points. This is particularly useful if there are many
8+
data points with similar errors.
89
"""
910

1011
import numpy as np
@@ -20,21 +21,20 @@
2021
y2err = 0.1 + 0.1 * np.sqrt(x/2)
2122

2223

23-
# Now switch to a more OO interface to exercise more features.
24-
fig, (ax_l, ax_c, ax_r) = plt.subplots(nrows=1, ncols=3,
25-
sharex=True, figsize=(12, 6))
24+
fig, (ax0, ax1, ax2) = plt.subplots(nrows=1, ncols=3, sharex=True,
25+
figsize=(12, 6))
2626

27-
ax_l.set_title('all errorbars')
28-
ax_l.errorbar(x, y1, yerr=y1err)
29-
ax_l.errorbar(x, y2, yerr=y2err)
27+
ax0.set_title('all errorbars')
28+
ax0.errorbar(x, y1, yerr=y1err)
29+
ax0.errorbar(x, y2, yerr=y2err)
3030

31-
ax_c.set_title('only every 6th errorbar')
32-
ax_c.errorbar(x, y1, yerr=y1err, errorevery=6)
33-
ax_c.errorbar(x, y2, yerr=y2err, errorevery=6)
31+
ax1.set_title('only every 6th errorbar')
32+
ax1.errorbar(x, y1, yerr=y1err, errorevery=6)
33+
ax1.errorbar(x, y2, yerr=y2err, errorevery=6)
3434

35-
ax_r.set_title('second series shifted by 3')
36-
ax_r.errorbar(x, y1, yerr=y1err, errorevery=(0, 6))
37-
ax_r.errorbar(x, y2, yerr=y2err, errorevery=(3, 6))
35+
ax2.set_title('second series shifted by 3')
36+
ax2.errorbar(x, y1, yerr=y1err, errorevery=(0, 6))
37+
ax2.errorbar(x, y2, yerr=y2err, errorevery=(3, 6))
3838

39-
fig.suptitle('Errorbar subsampling for better appearance')
39+
fig.suptitle('Errorbar subsampling')
4040
plt.show()

0 commit comments

Comments
 (0)
0