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
Plotnine legend position is reset after using patchworklib #17
Comments
I'm sorry for the late response. Could you share the example code that can reproduce the issue you posted? import patchworklib as pw
from plotnine import *
from plotnine.data import *
g1 = pw.load_ggplot(ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))
+ geom_point() + stat_smooth(method='lm')
+ facet_wrap('~gear')
+ theme(legend_position=(.5, -0.2), legend_direction='horizontal'),
figsize=(3,3))
g2 = pw.load_ggplot(ggplot(data=diamonds)
+ geom_bar(mapping=aes(x="cut", fill="clarity"), position="dodge")
+ theme(legend_position=(.5, -0.2), legend_direction='horizontal'),
figsize=(5, 2))
(g1.outline|g2.outline).savefig() Actually, patchworklib cannot perfectly reproduce the original legend position in the single plotnine plot, so please adjust according to the output figure. |
Hmm, your example looks good. Mine didn't work... You can see the original ggplots have the legend below, but after using patchworklib they get reset to the right. Let me check my versions. Plotnine version 0.8.0, patchworklib version 0.4.2. I'll update and see if that helps. |
Okay, I updated versions to plotnine 0.9.0 and patchworklib to 0.4.3 and it looks like yours now! Perfect, thanks. |
I've noticed that my original ggplot legend position is not maintained after patching together. I used...
...to position it underneath each individual ggplot before combining with patchworklib. However, after patching together, the legend goes back to the right side for every sub-plot.
Is this related to the same issue as in #15? Thanks.
The text was updated successfully, but these errors were encountered: