python - enlarging the figure in the pop-out window in matplotlib -


how enlarge figure inside pop-out window? use following code generate figure:

self._fig = plt.figure() #self._fig = plt.figure(figsize=(2,1)) # tried this, didn't work, change size of pop-out window, figure ax1 = self._fig.add_subplot(211,projection='3d')  # code plotting lines , drawing spherical surfaces, not shown here  ax1.set_xlim(-6,6) ax1.set_ylim(-6,6) ax1.set_zlim(-15,15) ax1.set_aspect(2.5, 'box') # axis limit , aspect limit chosen whole figure has same scale in directions #ax1.view_init(elev=90, azim=0)  ax1.set_xlabel('x-axis') ax1.set_ylabel('y-axis') ax1.set_zlabel('z-axis')   ax1.grid(true) 

you can see there lot of unused space in pop-out window, , figure looks small. want maximize size of figure fills whole pop-out window. if manually enlarge pop-out window, figure still looks same.

i tried varying axis limits, doesn't seem work. tried setting figsize in first line, changes size of pop-out window, figure itself.

another problem want change 'camera-view' of figure z-axis (the lone axis) horizontal. again, tried range of different values in ax.view_init, can't view want. allows me rotate around z-axis, while need rotate around x or y-axis 90deg.

enter image description here

try calling plt.tight_layout()

before call plt.show()


Comments