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

ggarrange generates an extra figure in rpy2 magic cell of a python Jupyter notebook #158

Closed
xiaohk opened this issue Feb 19, 2019 · 4 comments

Comments

@xiaohk
Copy link

xiaohk commented Feb 19, 2019

I am using rpy2 to embed ggplot plots in my Python Jupyter notebook. I am also using the function ggarrange() from ggpubr to concatenate multiple plots.

If I add the argument common.legend in ggarrange(), this R magic cell will display two images (one empty image and one output figure). The cell only displays one figure if common.legend is not included.

Here is a demo of this error.

@Dorpolo
Copy link

Dorpolo commented Aug 29, 2019

Hey, I'm following up here to check if you have find any solution for this issue ?
Thanks!

@xiaohk
Copy link
Author

xiaohk commented Aug 29, 2019

@Dorpolo Unfortunately, nope :(

@kassambara
Copy link
Owner

Similar discussions have been posted on stackoerflow here and here.

It should be possible to fix the problem by opening a null pdf device.

p <- ggboxplot(ToothGrowth, "dose", "len", color = "supp") 
pdf(NULL)
res <- ggarrange(p,p)
x <- dev.off()
res

Let me know if this solution works on your computer

@kassambara
Copy link
Owner

fixed now, thanks

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

3 participants