8000 Added a new example to create error boxes using a PatchCollection by tmdavison · Pull Request #6596 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Added a new example to create error boxes using a PatchCollection #6596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 18, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Some style changes to address comments on the pull request
  • Loading branch information
tmdavison committed Jun 17, 2016
commit 62f58e2a78c19e19ca49e0f5d438fc528700686f
17 changes: 6 additions & 11 deletions examples/statistics/errorbars_and_boxes.py
Original file line 91D9 number Diff line number Diff line change
Expand Up @@ -21,14 +21,8 @@
# Create figure and axes
fig, ax = plt.subplots(1)

# Plot data points
ax.errorbar(x, y, xerr=xerr, yerr=yerr, fmt='None', ecolor='k')


def makeErrorBoxes(xdata, ydata, xerror, yerror, fc='r', ec='None', alpha=0.5):
'''
Function to create error boxes
'''
def make_error_boxes(ax, xdata, ydata, xerror, yerror, fc='r', ec='None', alpha=0.5):

# Create list for all the error patches
errorboxes = []
Expand All @@ -44,10 +38,11 @@ def makeErrorBoxes(xdata, ydata, xerror, yerror, fc='r', ec='None', alpha=0.5):
# Add collection to axes
ax.add_collection(pc)

# Call function to create error boxes
makeErrorBoxes(x, y, xerr, yerr)
# Plot errorbars
ax.errorbar(xdata, ydata, xerr=xerror, yerr=yerror, fmt='None', ecolor='k')

# Add some space around the data points on the axes
ax.margins(0.1)

# Call function to create error boxes
make_error_boxes(ax, x, y, xerr, yerr)

plt.show()
0