matplotlib-users

 [Matplotlib-users] Confidence Interval From: Willi Richert - 2006-06-02 08:23:23 ```Hi, is there a way to display confidence intervals other than using Polygon like, e.g. ax = subplot(111) # make the shaded region upperPoints = zip(runs, upperConf) upperPoints.reverse() verts = [(runs[0], upperConf[0])] + zip(runs, lowerConf) + upperPoints poly = Polygon(verts, facecolor=0.6, edgecolor=0.6) ax.add_patch(poly) Best regards, wr ```
 Re: [Matplotlib-users] Confidence Interval From: John Hunter - 2006-06-03 15:21:34 ```>>>>> "Willi" == Willi Richert writes: Willi> Hi, is there a way to display confidence intervals other Willi> than using Polygon like, e.g. Willi> ax = subplot(111) # make the shaded region upperPoints = Willi> zip(runs, upperConf) upperPoints.reverse() verts = Willi> [(runs[0], upperConf[0])] + zip(runs, lowerConf) + Willi> upperPoints poly = Polygon(verts, facecolor=0.6, Willi> edgecolor=0.6) ax.add_patch(poly) Have you seen fill? http://matplotlib.sourceforge.net/screenshots.html#fill_demo For upper and lower bounds, you need to reverse the x values for the lower bounds, so the polygon will fill in order. Here's how you would do it with it with lists (untested), where x are the x data points and upper and lower are len(x) lists with the upper and lower confidence bounds xr = x[:] xr.reverse() lower.reverse() fill(x + xr, upper + lower) JDH ```