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

Package of export isn't incompatible with ggbreak? #37

Closed
Frank-plant opened this issue Dec 27, 2021 · 2 comments
Closed

Package of export isn't incompatible with ggbreak? #37

Frank-plant opened this issue Dec 27, 2021 · 2 comments

Comments

@Frank-plant
Copy link

Frank-plant commented Dec 27, 2021

ggbreak is helpful for plotting using ggplot2. However, after using ggplot2 combined with ggbreak, there is a error: Error in grid.newpage() : pptx device only supports one page when I use graph2ppt of package export to save plots as pptx.

p1=df_enzyme %>% ggplot(aes(Time,pro,fill=Treatment)) +
  stat_summary(fun = "mean", geom = "bar", alpha = .9, position = position_dodge(0.8),width=0.8) +
  stat_summary(geom = "errorbar",position = position_dodge(0.8),width = .2) +
  stat_compare_means(method = "t.test",label = "p.signif") +
  facet_grid(~Cultivar,labeller=labeller(Cultivar = c("1"="A. lagopoides","5"="P. antidotale","3"="U. setulosa"))) +
  scale_y_break(breaks= c(180,300),scales="free")+
  scale_fill_manual(values = c("#00AF46FF","#FF2643FF"))+
  theme_minimal(base_family = "serif",base_size=15)+
  theme(strip.text = element_text(face="bold.italic"))

graph2ppt(x=p1,file="report",append=T,margins=0)

there is a error: Error in grid.newpage() : pptx device only supports one page

When I don't use ggbreak, the error doesn't appear

p1=df_enzyme %>% ggplot(aes(Time,pro,fill=Treatment)) +
  stat_summary(fun = "mean", geom = "bar", alpha = .9, position = position_dodge(0.8),width=0.8) +
  stat_summary(geom = "errorbar",position = position_dodge(0.8),width = .2) +
  stat_compare_means(method = "t.test",label = "p.signif") +
  facet_grid(~Cultivar,labeller=labeller(Cultivar = c("1"="A. lagopoides","5"="P. antidotale","3"="U. setulosa"))) +
  #scale_y_break(breaks= c(180,300),scales="free")+
  scale_fill_manual(values = c("#00AF46FF","#FF2643FF"))+
  theme_minimal(base_family = "serif",base_size=15)+
  theme(strip.text = element_text(face="bold.italic"))

graph2ppt(x=p1,file="report",append=T,margins=0)

I want to know if it is possible to fix this error.
Cheers,
Xiaohui

@GuangchuangYu
Copy link
Member

GuangchuangYu commented Dec 27, 2021

maybe you can try graph2ppt(x = print(p1), ...).

@Frank-plant
Copy link
Author

maybe you can try graph2ppt(x = print(p1), ...).

maybe you can try graph2ppt(x = print(p1), ...).

Thank you. That's great. This method has solved this error.

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