not sure why it doesn't work, but try the following:
first, plot to a regular window, then run:
> dev.copy(device=png, file="yourfilename.png")
> dev.off()
see if that produces a file you want.
another note: what do you mean you can't just "copy and paste the
graph"
in ubuntu? doesn't pressing print-screen make a screenshot? doesn't
pressing alt-printscreen make a screenshot of the current active window?
(or even from the main menu, "applications-> accessories -> take
screenshot" should work).
on 06/26/2008 08:43 PM Sam Albers said the following:> I have trying to figure this out all day so hopefully the answer isn't
too
> obvious. I am able to view a graph in the viewer window. However, I need to
> export graph outside of the viewer window. Here is the script I am using:
>
>> png("Compare.png")
>> plot(compare$DepthSLI, compare$DischargeSLI, col="blue", xlab
= "Average
> Water Depth (cm)", ylab = "Discharge (m^3/s)", xlim=c(5,40),
> ylim=c(0.03,0.1), main="Discharge in Flume 1")
>> dev.off()
> null device
> 1
>
> When I do this R simply produces an empty file that produces an error
> message when I try to open it. I have tried this same script with every
file
> format available under help(device) all with the same result. I am running
> Ubuntu 8.04 so I unable to simply copy and paste the graph as in windows. I
> am fairly sure I have all the right packages installed. I am running R
> 2.6.2-2. Any suggestions?
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>