[R] plot and save as png

arun smartpink111 at yahoo.com
Thu Mar 21 20:27:53 CET 2013


Hi,
I am not sure about the problem.

I am able to generate the pdf.
with the codes:
png(filename = "fname.png", width = 900, height = 600, units = 'px')
layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE))
plot(sin, -pi, 10*pi)
plot(sin, -pi, 20*pi)
plot(sin, -pi, 30*pi)
plot(sin, -pi, 40*pi)
dev.off()

A.K.



----- Original Message -----
From: Sarah Goslee <sarah.goslee at gmail.com>
To: veepsirtt <veepsirtt at gmail.com>
Cc: r-help <r-help at r-project.org>
Sent: Thursday, March 21, 2013 3:18 PM
Subject: Re: [R] plot and save as png

Hi,

So when you run the code suggested:

png(filename = "fname.png", width = 900, height = 600, units = 'px')
layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE))
plot(sin, -pi, 10*pi)
plot(sin, -pi, 20*pi)
plot(sin, -pi, 30*pi)
plot(sin, -pi, 40*pi)
dev.off()

exactly like that, you do not get a file named fname.png in your
working directory?

Do you get an error message, or any other information from the R console?

Sarah

On Thu, Mar 21, 2013 at 1:55 PM, veepsirtt <veepsirtt at gmail.com> wrote:
> Hi A.K
>
> This is working
> layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE))
> plot(sin, -pi, 10*pi)
>  plot(sin, -pi, 20*pi)
>  plot(sin, -pi, 30*pi)
> plot(sin, -pi, 40*pi)
> dev.off()
> but if I add this line
> png(filename = "fname.png", width = 900, height = 600, units = 'px')
>  no plot is generated.
> where is the problem?.
>
> thanks
> veepsirtt
>
>
>
>> png(filename = "fname.png", width = 900, height = 600, units = 'px')
>> layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE))
>> plot(sin, -pi, 10*pi)
>>  plot(sin, -pi, 20*pi)
>>  plot(sin, -pi, 30*pi)
>> plot(sin, -pi, 40*pi)
>> dev.off()
> null device
>           1
>> sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tools_2.15.1
>>
>
>
> On Mon, Mar 18, 2013 at 6:36 PM, arun kirshna [via R] <
> ml-node+s789695n4661660h40 at n4.nabble.com> wrote:
>
>> Hi,
>>
>> Couldn't reproduce your problem.
>> Using your code, I am getting the image below:
>> A.K.
>>
>
>

--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fname.png
Type: image/png
Size: 31222 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130321/3651726e/attachment.png>


More information about the R-help mailing list