[R] How I assign the result of a plot to a variable?

2012-01-29 Thread Ajay Askoolum
I can write a plot to a files of a given format using this:

x-sample(c(1:100),10)
bmp(c:/mygraph.bmp)
plot(x)
dev.off()

and then show the image file in another application. This application can also 
display the image from the stream of numbers that define the image.

How I can get the plot as a stream of numbers?

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] How I assign the result of a plot to a variable?

2012-01-29 Thread baptiste auguie
Try this,

plot(1:10)
img - grid::grid.cap()
# grid.raster(img)
stream - col2rgb(img)
write.table(stream, file=dam.txt, row.names = FALSE,
col.names = FALSE)

(you'll have to restore the dimensions of the matrix once you've read
the rgb values for each pixel)

HTH,

baptiste

On 30 January 2012 08:27, Ajay Askoolum aa2e...@yahoo.co.uk wrote:
 I can write a plot to a files of a given format using this:

 x-sample(c(1:100),10)
 bmp(c:/mygraph.bmp)
 plot(x)
 dev.off()

 and then show the image file in another application. This application can 
 also display the image from the stream of numbers that define the image.

 How I can get the plot as a stream of numbers?

        [[alternative HTML version deleted]]

 __
 R-help@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.

__
R-help@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.