python - Subplot with equal aspect ratio -


i plot 2 subplots in same row same aspect ratio. it's quite ugly otherwise !

so, usually, i'm using axes().set_aspect('equal') (because want remove axis, , can't use 'off' , 'equal') pylab doesn't work right here, 2nd picture appears

my code:

plt.subplot(1,2,1) axes().set_aspect('equal') plt.tricontourf(x_exp, y_exp, z_exp) plt.colorbar(shrink=0.9,drawedges=true, orientation='vertical') plt.axis('off') plt.title('tricontour')  plt.subplot(1,2,2) axes().set_aspect('equal') plt.tricontourf(x_exp, y_exp, z_exp2) plt.colorbar(shrink=0.9,drawedges=true, orientation='vertical') plt.axis('off') plt.title('tricontour')  plt.show() 

it work following line subplot doesn't have tricontourf plot !

fig = plt.figure() ax1 = fig.add_subplot(2,1,1, adjustable='box', aspect=0.3) ax2 = fig.add_subplot(2,1,2)

do have idea figure out ?

edit: sample of data

i have used np.savez("sample",x_exp=x_exp,y_exp=y_exp,z_exp=z_exp,z_exp2=z_exp2)to save data.

you can read following lines:

import numpy np data = np.load("sample.npz") x_exp = data['x_exp'] y_exp = data['y_exp'] z_exp = data['z_exp'] z_exp2 = data['z_exp2'] 

i think should want. define each axes subplots of figure , change properties equal aspect ratio , turn them off:

fig = plt.figure()  ax1 = fig.add_subplot(1,2,1) im = ax1.tricontourf(x_exp, y_exp, z_exp) plt.colorbar(im, drawedges=true, orientation='vertical') ax1.set_aspect('equal') ax1.set_axis_off() ax1.set_title('tricontour')  ax2 = fig.add_subplot(1,2,2) im = ax2.tricontourf(x_exp, y_exp, z_exp2) plt.colorbar(im, drawedges=true, orientation='vertical') ax2.set_aspect('equal') ax2.set_axis_off() ax2.set_title('tricontour')  plt.show() 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -