[R] fidelity of generated raster images (R and perl)

Scott Harrison harris41 at msu.edu
Fri Oct 15 20:00:47 CEST 2004


Wrap-up:

Different solutions were proposed for turning a matrix
into a bitmap.

Henrik Bengtsson <hb at maths.lth.se>
 >R.classes bundle from
 > (http://www.maths.lth.se/help/R/R.classes/)
 >MonochromeImage
 >R.classes is still not compatible with
 >2.0.0 (minor modification to DESCRIPTION etc
 > are needed) so you have use R v1.9.1 to try the below.
 >img <- MonochromeImage(1-bits) # 1=white, 0=black
 >image(img)
 >plot(img)
 >persp(img, phi=60, theta=150)
 >write(img, "foo.pbm") # Write directly

Martin Maechler <maechler at stat.math.ethz.ch>
 >I think the "most typical" alternative is to use image()

Roger.Bivand at nhh.no
 >Maybe use the write.pnm() function in the pixmap package
 >Another package you could explore is rimage, which looks relevant.

For the sake of being conventional and minimizing dependencies,
I had good success with the image() function.  It is very nice to know
there are other approaches if I need to optimize/customize what
I am doing more for this.

(As usual) learned a few more things about 'R' from the examples
provided by others.  Most grateful for your help.

Regards,
Scott




More information about the R-help mailing list