[R] getChannels(fig, "red")
Roger Bivand
Roger.Bivand at nhh.no
Tue Jan 28 20:10:03 CET 2003
On Tue, 28 Jan 2003, Francisco do Nascimento Junior wrote:
> Hello, expeRts,
>
> I'm using the function getChannels for capture the matriz of R,G,B of a
> figure. I think that its returns values between 0 and 255, but the matriz
> contents values between 0 and 1. Somebody could explain me that values are
> these, pls?
You are using library(pixmap) - it would help to say so, perhaps?
The lines of pixmapRGB() that answer your question are:
> datamax <- max(data)
> datamin <- min(data)
> data <- as.numeric(data)
> if (datamax > 1 || datamin < 0)
> data <- (data - datamin)/(datamax - datamin)
that is, the function you have used to make your data into class pixmapRGB
has converted it to the 0-1 interval, based on the largest and smallest
values in the combined layers. If you know what these were, you can get
your data values back.
Roger
> Tks,
> Francisco.
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Francisco Júnior,
> Computer Science - UFPE-Brazil
> "One life has more value that the
> world whole"
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> On Tue, 28 Jan 2003, John Fox wrote:
>
> > Dear Luis,
> >
> > At 04:23 PM 1/28/2003 +0000, Luis Silva wrote:
> > >Thanks to all! as.character solved my problem. And if I wanted
> > >different colors instead?
> >
> >
> > The argument col is also vectorized, so something like plot( ....,
> > col=class) will work if class consists of small intergers. Alternatively,
> > use class to index a vector of colors, as in col=c("red", "green",
> > "blue")[class].
> >
> > John
> >
> > -----------------------------------------------------
> > John Fox
> > Department of Sociology
> > McMaster University
> > Hamilton, Ontario, Canada L8S 4M4
> > email: jfox at mcmaster.ca
> > phone: 905-525-9140x23604
> > web: www.socsci.mcmaster.ca/jfox
> > -----------------------------------------------------
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the R-help
mailing list