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

Grid not displaying correctly if a single plotnine plot is printed first #52

Closed
imahorrry opened this issue Dec 6, 2023 · 2 comments
Closed

Comments

@imahorrry
Copy link

image

Code to reproduce on a new kernel

import patchworklib as pw
from plotnine import *
from plotnine.data import *
import plotnine
print(pw.__version__)
print(plotnine.__version__)

g1 = ggplot(mtcars) + geom_point(aes("mpg", "disp")) + ggtitle('abcde')
print(g1)

g1 = pw.load_ggplot(ggplot(mtcars) + geom_point(aes("mpg", "disp")) + ggtitle('abcde'), figsize=(2, 3))
g2 = pw.load_ggplot(ggplot(mtcars) + geom_point(aes("mpg", "disp")) + ggtitle('abcde'), figsize=(2, 3))
g = g1 | g2
g.savefig()

The workaround I found is to restart the kernel, plot a patchworklib plot on the new kernel, and then everything works correctly. One can also revert to plotnine 0.10.* versions. The following, for example, works as intended.

import patchworklib as pw
from plotnine import *
from plotnine.data import *
import plotnine
print(pw.__version__)
print(plotnine.__version__)

g1 = pw.load_ggplot(ggplot(mtcars) + geom_point(aes("mpg", "disp")) + ggtitle('abcde'), figsize=(2, 3))
g2 = pw.load_ggplot(ggplot(mtcars) + geom_point(aes("mpg", "disp")) + ggtitle('abcde'), figsize=(2, 3))
g = g1 | g2
g.savefig()

g1 = ggplot(mtcars) + geom_point(aes("mpg", "disp")) + ggtitle('abcde')
print(g1)
@ponnhide
Copy link
Owner

ponnhide commented Dec 7, 2023

Maybe, I have also modified this problem.
Could you check the developmental version that can be installed by "pip install git+https://github.com/ponnhide/patchworklib.git"?

@imahorrry
Copy link
Author

Works correctly now. Thank 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