Closed
Description
Bug report
Bug summary
A few hours ago #12098 was merged, which left-aligns JS Animation plots and thereby fixes #11795.
This brought to light another little inconsistency between JS Animations and "normal" plots.
The PNG data in the JS Animation seems to have a larger white margin than normal plots.
Therefore, if I plot a normal plot and then a similar JS Animation, the plot in the JS Animation shows up a bit further right (because of the PNG margin).
Code for reproduction
I'm using the examples from https://splines.readthedocs.io/en/latest/bezier.html
Actual outcome
Expected outcome
Ideally, the PNG data in the JS Animation should have the same white margin as "normal" PNG plots.
Matplotlib version
- Operating system: Debian Linux
- Matplotlib version:
master
(848d9fc a.k.a.3.0.0rc1.post275+g848d9fc56
) - Matplotlib backend:
module://ipykernel.pylab.backend_inline
- Python version: 3.6.6
- Jupyter version: JupyterLab 0.35.0a0
Metadata
Metadata
Assignees
Labels
No labels
Activity
WeatherGod commentedon Sep 14, 2018
mgeier commentedon Sep 15, 2018
@WeatherGod Indeed, I just checked with
savefig('myplot.png')
and it has the same white margin as the plots in the JS Animation. I wasn't aware that Jupyter manipulates the plots that it gets from Matplotlib.Any ideas how I could make this consistent?
Manually remove the margins from Matplotlib plots?
Tell Jupyter to keep the margins?
ImportanceOfBeingErnest commentedon Sep 15, 2018
I would also think that the way to make this consistent is rather to let jupyter not crop the figure.
You may use
in a cell before the plot, or generally set this option in your IPython configuration. (I don't know about the differences between juypterlab and jupyter notebook though)
I think you may also use the
ipympl
backend instead of inline, in which case the figure should never be cropped. (Again, not sure about the differences between jupyterlab and notebook here)mgeier commentedon Sep 18, 2018
Thanks @ImportanceOfBeingErnest, the suggested config setting for the
InlineBackend
works perfectly!I still have to look into the
ipympl
backend some day ...