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

Label size is not reserved from ggplot #15

Closed
ChenghaoMou opened this issue Jun 23, 2022 · 3 comments
Closed

Label size is not reserved from ggplot #15

ChenghaoMou opened this issue Jun 23, 2022 · 3 comments

Comments

@ChenghaoMou
Copy link

Hi, thanks for this cool library!

I noticed that several set_*label calls in load_ggplot doesn't pass on any other style settings such as font size so the axis title always ends up being size 12.

Let me know if you need more information on this.

@ponnhide
Copy link
Owner

Thank you for your comments.
As you mentioned, now, load_ggplot cannot reflect the style settings properly.
After the formal release of plotnine 0.9.0 (plotnine seems to be currently being updated), I will fix these problems.

@ponnhide
Copy link
Owner

I have now updated patchworklib and probably solved the issue.
After updating patchworklib and plotnine, please execute the following code.

import patchworklib as pw
from plotnine import *
from plotnine.data import *
g1 = pw.load_ggplot(ggplot(mtcars) 
                    + geom_point(aes("mpg", "disp"))
                    + theme(text=element_text(size=14), axis_title=element_text(size=18)),
                    figsize=(2,3))
g2 = pw.load_ggplot(ggplot(mtcars) 
                    + geom_boxplot(aes("gear", "disp", group="gear"))
                    + theme(text=element_text(size=14), axis_title=element_text(size=18)), 
                    figsize=(2,3))
g3 = pw.load_ggplot(ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)')) 
                    + geom_point() + stat_smooth(method='lm') 
                    + facet_wrap('~gear')
                    + theme(text=element_text(size=14), axis_title=element_text(size=18)), 
                    figsize=(3,3))
g4 = pw.load_ggplot(ggplot(data=diamonds) 
                    + geom_bar(mapping=aes(x="cut", fill="clarity"), position="dodge")
                    + theme(text=element_text(size=14), axis_title=element_text(size=20, color="blue"), 
                            legend_text=element_text(size=14), legend_title=element_text(size=18)), 
                    figsize=(5,2))
g1234 = (g1|g2|g3)/g4
g1234.savefig()

You will get the following output.
download

If you face any problems, please let me know.

@ChenghaoMou
Copy link
Author

Thank you so much for the fix!

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