![]() ![]() ![]() When constructing subplots, you can alter the spacing and layout of the subplots. Insights New issue 3d plots with aspect'equal' 1077 Closed akhmerov opened this issue on 30 comments Contributor akhmerov commented on The figure is rendered with all axes scaled to the data scale, thus ignoring the aspect setting. You may use the subplotsadjust () function. You can change the margins and white space surrounding the figure. Example Draw 2 plots on top of each other: import matplotlib.pyplot as plt import numpy as np plot 1: x np.array ( 0, 1, 2, 3) y np.array ( 3, 8, 1, 10) plt.subplot (2, 1, 1) plt. It's quite ugly otherwise So, usually, I'm using axes().setaspect('equal') (because I want ALSO to remove the axis, and I can't use 'off' AND 'equal') from pylab but it doesn't work right here, only the 2nd picture appears. I have used np.savez("Sample",x_exp=x_exp,y_exp=y_exp,z_exp=z_exp,z_exp2=z_exp2)to save the data. This utility wrapper makes it convenient to create common layouts of subplots, including the enclosing figure object, in a single call. This guide changes the spacing to produce a square image or array with an equal aspect ratio. I would like to plot 2 subplots in the same row with the same aspect ratio. 73 import matplotlib.pyplot as plt from mpltoolkits.mplot3d import Axes3D Setting the aspect ratio works for 2d plots: ax plt.axes () ax.plot ( 0,1, 0,10) ax.setaspect ('equal','box') But does not for 3d: ax plt.axes (projection'3d') ax.plot ( 0,1, 0,1, 0,10) ax. ![]() It could probably work with the following line but subplot doesn't have the tricontourf plot !Īx1 = fig.add_subplot(2,1,1, adjustable='box', aspect=0.3) Let's say I want to plot two different functions that have different extents on the y axis. Plt.colorbar(shrink=0.9,drawedges=True, orientation='vertical') How to set same aspect ratio for subplots in matplotlib Ask Question Asked 3 years, 7 months ago Modified 3 years, 7 months ago Viewed 3k times 0 I want to have a row of subplots with the same aspect ratio. So, usually, I'm using axes().set_aspect('equal') (because I want ALSO to remove the axis, and I can't use 'off' AND 'equal') from pylab but it doesn't work right here, only the 2nd picture appears I would like to plot 2 subplots in the same row with the same aspect ratio. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |