Issue
I love using Jupyter notebooks, but can't seem to find the correct backend for visualizing plots: %matplotlib inline
generates really low-resolution, bitmap images, but fast, and %matplotlib nbagg
or %matplotlib notebook
are slow, but high-resolution vector graphics.
Could the latter be slow because it has to set up the interaction interface? I generally want all my figures to be reproducible with the click of a button so I don't want to manually manipulate them -- maybe I can disable interaction for every plot?
Or could the former be adjusted to show figures in higher-resolution, or to load up vector graphics instead of the bitmap images?
Solution
As often happens, I found the answer right after posting the question. Just use
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
for high-resolution bitmap, or for vector graphics,
%config InlineBackend.figure_format = 'svg'
%matplotlib inline
and that does the trick!
Also figured out how to make the backend preserve the printed-figure bounding box even if Artist
s go outside -- just use
%config InlineBackend.print_figure_kwargs = {}
because by default, its value is {'bbox_inches': 'tight'}
. Could not find any documentation on this, but jupyter
displays the different options if you enter %config InlineBackend
.
Answered By - Luke Davis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.