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 e04f9d8

Browse filesBrowse files
jklymakMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR matplotlib#14098: Improve Errorbar limits example
1 parent cd8b27a commit e04f9d8
Copy full SHA for e04f9d8

File tree

Expand file treeCollapse file tree

1 file changed

+26
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-14
lines changed

‎examples/lines_bars_and_markers/errorbar_limits_simple.py

Copy file name to clipboardExpand all lines: examples/lines_bars_and_markers/errorbar_limits_simple.py
+26-14Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
"""
2-
===============
3-
Errorbar Limits
4-
===============
2+
========================
3+
Errorbar limit selection
4+
========================
55
6-
Illustration of upper and lower limit symbols on errorbars.
6+
Illustration of selectively drawing lower and/or upper limit symbols on
7+
errorbars using the parameters ``uplims``, ``lolims`` of `~.pyplot.errorbar`.
8+
9+
Alternatively, you can use 2xN values to draw errorbars in only one direction.
710
"""
811

912
import numpy as np
@@ -12,36 +15,45 @@
1215

1316
fig = plt.figure()
1417
x = np.arange(10)
15-
y = np.sin(x / 20 * np.pi)
18+
y = 2.5 * np.sin(x / 20 * np.pi)
1619
yerr = np.linspace(0.05, 0.2, 10)
1720

18-
plt.errorbar(x, y, yerr=yerr)
21+
plt.errorbar(x, y + 3, yerr=yerr, label='both limits (default)')
1922

20-
plt.errorbar(x, y + 1, yerr=yerr, uplims=True)
23+
plt.errorbar(x, y + 2, yerr=yerr, uplims=True, label='uplims=True')
2124

22-
plt.errorbar(x, y + 2, yerr=yerr, uplims=True, lolims=True)
25+
plt.errorbar(x, y + 1, yerr=yerr, uplims=True, lolims=True,
26+
label='uplims=True, lolims=True')
2327

2428
upperlimits = [True, False] * 5
2529
lowerlimits = [False, True] * 5
26-
plt.errorbar(x, y + 3, yerr=yerr, uplims=upperlimits, lolims=lowerlimits)
30+
plt.errorbar(x, y, yerr=yerr, uplims=upperlimits, lolims=lowerlimits,
31+
label='subsets of uplims and lolims')
32+
33+
plt.legend(loc='lower right')
34+
2735

28-
###############################################################################
36+
##############################################################################
37+
# Similarly ``xuplims``and ``xlolims`` can be used on the horizontal ``xerr``
38+
# errorbars.
2939

3040
fig = plt.figure()
3141
x = np.arange(10) / 10
3242
y = (x + 0.1)**2
3343

34-
plt.errorbar(x, y, xerr=0.1, xlolims=True)
44+
plt.errorbar(x, y, xerr=0.1, xlolims=True, label='xlolims=True')
3545
y = (x + 0.1)**3
3646

37-
plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits)
47+
plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits,
48+
label='subsets of xuplims and xlolims')
3849

3950
y = (x + 0.1)**4
40-
plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True)
51+
plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True, label='xuplims=True')
4152

53+
plt.legend()
4254
plt.show()
4355

44-
#############################################################################
56+
##############################################################################
4557
#
4658
# ------------
4759
#

0 commit comments

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