[R] ggsave in Linux

Ista Zahn istazahn at gmail.com
Wed Feb 24 20:46:28 CET 2010


See below.

On Wed, Feb 24, 2010 at 1:28 PM, Ryan Garner
<ryan.steven.garner at gmail.com> wrote:
>
> I have a script that creates a qplot that is then saved as a .png file which
> works fine on Windows. But I also work on Linux servers via Putty and would
> like to be able to create and save my plots to my working directory. Is
> there a way I can ggsave my qplot without utilizing X11 in Linux? I don't
> need to view the plot in Linux, I just want the plot created and immediately
> saved to my working directory.
>
> I get this error:
> Error in grDevices::png(..., width = width, height = height, res = dpi,  :
>  X11 is not available

You get this error when you do what? I'm guessing you are trying to
display the graphic, which of course won't work without a windowing
system. Try like this:

library(ggplot2)
data(diamonds)
temp <- qplot(cut, color, data=diamonds)
ggsave(temp, file = "test.pdf")


>
> --
> View this message in context: http://n4.nabble.com/ggsave-in-Linux-tp1567860p1567860.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list