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

Skip to content

Commit 56adbda

Browse files
authored
Merge pull request #8031 from vlas-sokolov/errorbars-mplot3d
Add errorbars to mplot3d
2 parents 3abdfa9 + 1c73204 commit 56adbda

File tree

6 files changed

+410
-1
lines changed

6 files changed

+410
-1
lines changed

doc/users/whats_new/errorbars_3d.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Errorbar method for mplot3d
2+
---------------------------
3+
4+
The errorbar function :meth:`matplotlib.axes._axes.Axes.errorbar` is ported
5+
into the `mplot3d` framework in its entirety. Supports features such as custom
6+
styling for error lines and cap marks, control over erorrbar spacing, upper and
7+
lower limit marks.

examples/mplot3d/errorbar3d.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
============
3+
3D errorbars
4+
============
5+
6+
An example of using errorbars with upper and lower limits in mplot3d.
7+
"""
8+
9+
import matplotlib.pyplot as plt
10+
import numpy as np
11+
12+
fig = plt.figure()
13+
ax = fig.gca(projection='3d')
14+
15+
# setting up a parametric curve
16+
t = np.arange(0, 2*np.pi+.1, 0.01)
17+
x, y, z = np.sin(t), np.cos(3*t), np.sin(5*t)
18+
19+
estep = 15
20+
i = np.arange(t.size)
21+
zuplims = (i % estep == 0) & (i // estep % 3 == 0)
22+
zlolims = (i % estep == 0) & (i // estep % 3 == 2)
23+
24+
ax.errorbar(x, y, z, 0.2, zuplims=zuplims, zlolims=zlolims, errorevery=estep)
25+
26+
ax.set_xlabel("X label")
27+
ax.set_ylabel("Y label")
28+
ax.set_zlabel("Z label")
29+
30+
plt.show()

0 commit comments

Comments
 (0)