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?
In Preferences > IPython console > Graphics > Inline backend you can adjust the width, height and dpi of inline figures.
Why matplotlib inline is used. You can use the magic function %matplotlib inline to enable the inline plotting, where the plots/graphs will be displayed just below the cell where your plotting commands are written. It provides interactivity with the backend in the frontends like the jupyter notebook.
The options menu in the top right of the Plots pane offers several ways to customize how your plots are displayed.
(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
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With