Plot a contour inside a contour

Isaac Won winefrog at gmail.com
Thu Nov 14 20:39:37 CET 2013


I tried to plot one smaller contour inside of the other larger contour. I have two different 2D-arrays. One is with smaller grid spacing and smaller domain size and the other is with larger spacing and larger domain size. So, I tried to use fig.add_axes function as follows:
fig = plt.figure()
ax1 = fig.add_axes([0.1,0.1,0.8,0.8])
             .    
             .
dx       = 450
NX       = SHFX_plt.shape[1]
NY       = SHFX_plt.shape[0]
xdist    = (np.arange(NX)*dx+dx/2.)/1000. 
ydist    = (np.arange(NY)*dx+dx/2.)/1000.
myPLT = plt.pcolor(xdist,ydist,SHFX_plt)
             .
             .    
ax2 = fig.add_axes([8.,8.,18.,18.])
dx1      = 150
NX1       = SHFX_plt1.shape[1]
NY1       = SHFX_plt1.shape[0]
print 'NX1=',NX1,'NY1=',NY1
xdist1    = (np.arange(NX1)*dx1+dx1/2.)/1000.
ydist1    = (np.arange(NY1)*dx1+dx1/2.)/1000.
myPLT1 = plt.pcolor(xdist1,ydist1,SHFX_plt1)
plt.show()

My intention is to plot ax2 on the top of ax1 from xdist and ydist = 8 with 18 by 18 size.

However, the result seems only showing ax1.

I will really appreciate any help or idea.

Thank you, Isaac



More information about the Python-list mailing list