r - How to output geom_raster() to a raster image? -


I am doing quantitative image analysis, and looking at results ggplot2. In the original image there is a datapoint in output for each pixel.

geom_raster () Imagines my data in R well. But it would be good for a raster image , in this way, I flipped through several derived images using a light image viewer (e.g., feh ) I can, and pixels will have to be raised altogether.

Is there an easy way to output pixels, and only pixels in an image file? No legend, no ax, nothing but pixels let me have columns for data.frame in the line and call And the desired output resolution is also known.

Here's a way:

  Library (ggplot2) library ( Reshape2) # to melt (...) n & lt; - 100 sets.seed (1) #productive example img & lt; - Matrix (rnorm (n ^ 2,30,3), nc = n) gg & lt; - Melt (data. Frames (x = 1: n, img), id = "x") ggplot (gg) + geom_raster (aes (x = x, y = variable, fill = value)) + scale_x_continuous (extension = c (0,0)) + # Extra space (fill = FALSE) + # on the x-axis guides to get rid off the legend theme (axis text = element_blank), close axis = axis = axis = Element_blank (), axis.title = element_blank ())   

< / P>

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -