Reputation: 3106
When I have a figure plotted from a script, I am able to vary the figure size as desired:
plt.figure(1,figsize=(20,20),dpi=72)
plt.imshow(a)
plt.show()
but when I do this in the iPython console, I cant get the figure size to vary. Why is this happening?
Upvotes: 18
Views: 23201
Reputation: 34136
(Spyder maintainer here) By default the figures created in the Spyder IPython console are PNG files of fixed size.
If you want to zoom in/out or pan to left/right in a Matplotlib figure, you need to change your graphics backend from Inline
(the default) to Automatic
. You can do this by going to the menu
Tools > Preferences > IPython console > Graphics > Graphics backend
After doing this and restarting the kernel of the IPython console, or creating a new console, all Matplotlib figures will be created in a new window with controls for zooming and panning.
Finally, if you want to switch between Inline
and Automatic
while working in the console, you need to run these commands
%matplotlib inline
to select the Inline
backend.%matplotlib qt5
or %matplotlib qt
(depending if you're using Qt4 or Qt5) to select Automatic
.Upvotes: 27