By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

Is there any way to even the scale of the axes?

P: 1
0


I want to visualize the result of some calculations. Here is part of my code:

Expand|Select|Wrap|Line Numbers
  1. fig = plt.figure(figsize=(10, 10))
  2. ax = fig.add_subplot(111, projection='3d')
  3. Lx = np.linspace(0, h_x*(N/2-1)+x_size, int(1.5*N))
  4. Ly = np.linspace(0, h_y*(N/2-1)+y_size, int(1.5*N))
  5. X, Y = np.meshgrid(Lx, Ly)
  6. surf = ax.plot_surface(X, Y, W, cmap=mpl.cm.hsv)
  7. fig.colorbar(surf, shrink=0.75, aspect=15)
  8. plt.show()
After plotting I have images like that. And there is one big problem: the scales of Ox and Oy are not equal. If I put ax.axis('equal') in any place of my code, images will look like that. But they are not very nice. I don't understand, are there some differences between putting this string before or after the plotting, so I have tried both of variants. In matplotlib documentation I have read about changing dimensions of the plot box with the help of ax.axis.('scaled'). But if I try to use this string, I get the empty plot box.

And one more question. In the old version of the program there was such string: ax.plot(x, y, z, linewidth=5, color='k', ls='solid') (x, y, z - coordinates of the tops of the rectangle). So I had black rectangle on my images. And nowadays instead the rectangle I have a lot of small dots. It is very strange, because I don't change anything in the old code.
3 Weeks Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.