Can't figure this out: I create a figure, add some axes, define data to be
plotted as a contourf + contour on top and then add some patches to hide some
regions of my plot.
The patches hide the contourf correctly, as expected, but not the contour
lines...
Could someone telle me whether I'm doing something wrong ?
Below are the code lines.
I'm using python 2.4, matplotlib 0.91.2
Thanks in advance,
Aure
#----------
pylab.clf()
fig = pylab.figure(figsize=(7.,3.8),dpi=100,facecolor='white')
axes1 = fig.add_axes((.....),label='axes1')
axes2 = fig.add_axes((.....),label='axes2')
axes3 = fig.add_axes((.....),label='axes3')
#define contour data
contourstep = 0.05
contourx = np.arange(0.01,2.5+contourstep,contourstep)
contoury = np.arange(0.01,4.+contourstep,contourstep)
contourxy1 = np.ones((len(contoury),len(contourx)))
contourxy2 = np.ones((len(contoury),len(contourx)))
x = np.arange(0.,6.,0.01)
for j in range(contourxy1.shape[0]):
for k in range(contourxy1.shape[1]):
newval1=...
newval2=...
contourxy1[j,k] = newval1
contourxy2[j,k] = newval2
#add contour
levels = np.arange(0.0,0.85,0.05)
cf1 =
axes1.contourf(-contourx,contoury,contourxy2,levels,cmap=bone_r,extend = 'max')
#cmap=mpl.cm.gray_r)
cf2 = axes2.contourf(contourx,contoury,contourxy1,levels,cmap=bone_r,extend
= 'max') #cmap=mpl.cm.gray_r)
levels2 = np.arange(0.,.45,0.05)
axes1.contour(-contourx,contoury,contourxy2,levels2,colors='gray')
axes2.contour(contourx,contoury,contourxy1,levels2,colors='gray')
#add patches
axes1.add_patch(mpl.patches.Polygon([(-1.,1),(-2.,1.),(-2.,2.)],
edgecolor='k',
facecolor='w',
))
axes1.add_patch(mpl.patches.Polygon([(-1.,1.),(0.,0.),(0.,1.)],
edgecolor='k',
facecolor='w',
))
axes2.add_patch(mpl.patches.Polygon([(0.,1.),(2.,1.),(2.,2.),(0.,2.)],
edgecolor='k',
facecolor='w',
))
pylab.savefig(outputfilename)
#----------
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users