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]]
baptiste auguie
2012-Jan-29 19:42 UTC
[R] How I assign the result of a plot to a variable?
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 <aa2e72e at 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 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.