Logo Search packages:      
Sourcecode: matplotlib version File versions  Download package

histogram_path_demo Namespace Reference

Detailed Description

This example shows how to use a path patch to draw a bunch of
rectangles.  The technique of using lots of Rectangle instances, or
the faster method of using PolyCollections, were implemented before we
had proper paths with moveto/lineto, closepoly etc in mpl.  Now that
we have them, we can draw collections of regularly shaped objects with
homogeous properties more efficiently with a PathCollection.  This
example makes a histogram -- its more work to set up the vertex arrays
at the outset, but it should be much faster for large numbers of


tuple ax = fig.add_subplot(111)
tuple barpath = path.Path.make_compound_path_from_polys(XY)
tuple bottom = np.zeros(len(left))
tuple data = np.random.randn(1000)
tuple fig = plt.figure()
tuple left = np.array(bins[:-1])
tuple patch = patches.PathPatch(barpath, facecolor='blue', edgecolor='gray', alpha=0.8)
tuple right = np.array(bins[1:])
 top = bottom+n
tuple XY = np.array([[left,left,right,right], [bottom,top,top,bottom]])

Generated by  Doxygen 1.6.0   Back to index