Larger matplotlib images in Jupyter Notebook
Simple code to enable matplotlib to generate larger inline images in Jupyter Notebook.
When using Jupyter Notebook to write scripts in Python, the default matplotlib image size is very small. This may be a problem when writing code that will be used to analyse images.
One way to work around this is to change the header from %matplotlib inline
to %matplotlib notebook
. This will produce a larger plot, but not one that will be displayed inline directly below the code cell that produced it.
A better way is to use the rcParams
parameter as follows:
%matplotlib notebook
import matplotlib as mpl
mpl.rcParams['figure.figsize'] = [12, 12]
mpl.rcParams['figure.dpi'] = 72
Unfortunately the unit of measure for figure.figsize
is inches. The output will be larger but remain inline:
In Jupyter Notebook, you may need to place the last two lines in a separate cell for the changes to take effect, but the result will be larger inline images.
Comments
No comments have yet been submitted. Be the first!