21
21
# Create figure and axes
22
22
fig , ax = plt .subplots (1 )
23
23
24
- # Plot data points
25
- ax .errorbar (x , y , xerr = xerr , yerr = yerr , fmt = 'None' , ecolor = 'k' )
26
24
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 ):
32
26
33
27
# Create list for all the error patches
34
28
errorboxes = []
@@ -44,10 +38,11 @@ def makeErrorBoxes(xdata, ydata, xerror, yerror, fc='r', ec='None', alpha=0.5):
44
38
# Add collection to axes
45
39
ax .add_collection (pc )
46
40
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' )
49
43
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 )
52
47
53
48
plt .show ()
0 commit comments