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

Skip to content

Commit 62f58e2

Browse files
committed
Some style changes to address comments on the pull request
1 parent 7f412e8 commit 62f58e2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

examples/statistics/errorbars_and_boxes.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,8 @@
2121
# Create figure and axes
2222
fig, ax = plt.subplots(1)
2323

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

27-
28-
def makeErrorBoxes(xdata, ydata, xerror, yerror, fc='r', ec='None', alpha=0.5):
29-
'''
30-
Function to create error boxes
31-
'''
25+
def make_error_boxes(ax, xdata, ydata, xerror, yerror, fc='r', ec='None', alpha=0.5):
3226

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

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

50-
# Add some space around the data points on the axes
51-
ax.margins(0.1)
44+
45+
# Call function to create error boxes
46+
make_error_boxes(ax, x, y, xerr, yerr)
5247

5348
plt.show()

0 commit comments

Comments
 (0)