Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter inline plot only appears on second try #45

Closed
jingxuanlim opened this issue Feb 4, 2023 · 2 comments
Closed

Jupyter inline plot only appears on second try #45

jingxuanlim opened this issue Feb 4, 2023 · 2 comments

Comments

@jingxuanlim
Copy link

Hi. Just found your package and very excited to try additive blending :)

Before that, I wanted to get mplcairo working with my working environment -- Jupyter lab with %matplotlib widget (issue here) or at least %matplotlib inline).

I was able to get the latter to work -- sort of. The following cell needs to be run twice before the results appear.

After first run:

image

After second run:

image

Do you know why this is happening? Any help appreciated!

Result of mplcairo.get_versions()

{'python': '3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38) \n[GCC 7.3.0]',
 'mplcairo': '0.3',
 'matplotlib': '3.1.1',
 'cairo': '1.14.12',
 'freetype': '2.10.4',
 'pybind11': '2.5.0',
 'raqm': None}
@anntzer
Copy link
Collaborator

anntzer commented Feb 5, 2023

These versions are quite old; I cannot advise for them. As of the latest releases of matplotlib & jupyter, I find that the following patching works; can you confirm this?

%matplotlib inline
from matplotlib_inline import backend_inline
import mplcairo.base
backend_inline.backend_agg = mplcairo.base
backend_inline.FigureCanvasAgg = mplcairo.base.FigureCanvasCairo

However note that I don't use jupyter notebooks at all myself and thus have only a rather limited understanding of how they interact with matplotlib.

@anntzer
Copy link
Collaborator

anntzer commented Apr 16, 2023

Closing for lack of activity, feel free to request a reopen if the above doesn't work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants