-
Notifications
You must be signed in to change notification settings - Fork 154
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
How do you actually save the plot? #115
Comments
The plots can be saved with the conventional R graphics form:
or if you have the plot in a object
|
yes the usual R graphics works, but I'm getting an empty first page (followed by the second page with the plot) when I save it as pdf on Ubuntu 16.04... Any thoughts? |
Yes the blank page thing is a known issue: #90, try setting |
assigning the plot to an object returns |
The correct approach is the one from @RichardJActon
|
The |
So you can't use I tried to, but get: |
I'm hitting this problem when I'm piping the plot into ggsave, but it works correctly without the pipe. bad: ggplot() %>% ggsave() hope this helps |
Suggestion by lukaszkruk worked for me! I just saved the plot first and then used ggsave() |
Can you provide a sample for save PDF? When I save first time it always failed (after saveing, can not open PDF, said damaged). I then use RStudio, save again. It work. Very strange. What's wrong with following code to save PDF? `p1 <- upset(fromExpression(fit1$original.values), scale.intersections = "log10", pdf(file = outfn, onefile = FALSE) # or other device p1 |
@liuyangzzu , please try:
this should write a pdf to your working directory |
Another way to use ggsave() is to convert the plot into ggplot object using the ggplotify function as.ggplot(). Although this produces an awkard black box for me using jpeg and cairo.
|
@witszymanski that is what I meant by
Treat it as a work around and not a perfect solution :/ |
I guess it has something to do with the structure of the plot. That the one on the left is a separate plot embedded into the other one. Some hints here: |
for ggplotify issue, see #112. |
Creating a file: library(UpSetR)
pdf("what.pdf", onefile=FALSE)
example(upset)
dev.off() and running |
Hi, Just in case somebody still needs a better solution. I attach my code here to produce better resolution with png, tiff, and jpeg
hope it helps! Best, |
If you are saving inside a function, use the standard graphics devices, but explicitly
|
I know this is a noob question, but how do you actually get the output of the plot? I try ggsave and I get
I save the plot to a variable,
upset_plot
then
ggsave("plot.pdf",upset_plot)
The text was updated successfully, but these errors were encountered: