-
Notifications
You must be signed in to change notification settings - Fork 58
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
Question: Transparent background #91
Comments
Hi, @grssnbchr It is a little bit difficult for save GIF with ggplot2 and with a transparent background. Here is an example. for (i in 1:10) {
df=data.frame(x=1:10,y=rnorm(10, 1, 2))
ggplot(df, aes(x = x, y = y))+
geom_point()+ theme( legend.background = element_rect(fill = "transparent"), # get rid of legend bg
legend.box.background = element_rect(fill = "transparent"),
panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA)
)
ggsave(paste0(tempdir(),"/Rplot",i,".png"),bg="transparent")
}
im.convert(files=file.path(tempdir(),"Rplot*.png"),output = "A.gif",extra.opts = "-dispose previous") We will improve those functions for a better user experience in few weeks. |
Thank you, that basically works, yes. Looking forward to a package update though! |
I had the same issue. Use
This should give you the desired result. |
This is a question, not a bug report. I want to generate a GIF with ggplot2 and a transparent background. Even though I set the background to "transparent" in ggplot2's
theme
function, I don't get a transparent background in the final GIF. Is there an option which sets this? Or is this not even possible directly withsaveGIF
?The text was updated successfully, but these errors were encountered: