color vectors other than gray()
On Fri, 27 Mar 2009, Tsjerk Wassenaar wrote:
Hi, Have a look at: ?rainbow ?rgb ?heatmap
Furthermore, the packages colorspace, ggplot, plotrix, and RColorBrewer have useful tools for this. For the ides behind the palettes in colorspace, see Achim Zeileis, Kurt Hornik, and Paul Murrell (2009). Escaping RGBland: Selecting Colors for Statistical Graphics. Computational Statistics & Data Analysis, Forthcoming. doi:10.1016/j.csda.2008.11.033 Preprint: http://statmath.wu-wien.ac.at/~zeileis/papers/Zeileis+Hornik+Murrell-2008.pdf hth, Z
In my opinion this would've likely popped up with just a little effort of searching. In fact, the help of grey() (?grey) already gives pointers to the other color functions. Please show that you at least have tried to find answers before posting questions on a user list. Tsjerk On Fri, Mar 27, 2009 at 2:16 PM, Paulo E. Cardoso <pecardoso at netcabo.pt> wrote:
I'm trying to create a graph where different cells of a grid (a shapefile)
will be painted with a color share scale, where the most easy way is to use
gray().
Can I somehow get a vector (gradient) of colors, a vector of colors with
other methods but gray()?
I'm doing this until now
?quad_N_sp <-
merge(sp_dist[sp_dist$sp==splist[i],],grelha_ID,by.x="quad",by.y="quadricula
",all.y=T,)
?quad_N_sp$x[is.na(quad_N_sp$x)] <- 0
?quad_N_sp <- quad_N_sp[order(quad_N_sp$id),]
?paleta <- gray(1-(quad_N_sp$x)/max(quad_N_sp$x)) #! Tons de cinzento
?win.graph(4,5)
?plot(grelha,ol="grey80", #! Gr?fico com grelha de amostragem e gradiente
de abund?ncia
?fg=paleta,
?cex.lab=0.7,
?cex.axis=0.7,
?cex.main=0.7,
?xlab="Coord X",
?ylab="Coord Y",
?main=paste("Esp?cie: ",splist[i]),
?xlim=c(210000,240000)
?)
?col_lab <- c(max(quad_N_sp$x),min(quad_N_sp$x)) #! Vector com os limites
min e max do N de indiv?duos observados
color.legend(248000,120000,250000,128000,col_lab,sort(unique(paleta)),gradie
nt="y",cex=0.6)#! Legenda
?text(245300,130500,"N? Indiv?duos",cex=0.6)
?plot(blocos,ol="grey40",fg=NA,add=T)
I'd like to replace the grey shade by other colors.
Thanks in advance
____________ Paulo E. Cardoso ? ? ? ?[[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.
-- Tsjerk A. Wassenaar, Ph.D. Junior UD (post-doc) Biomolecular NMR, Bijvoet Center Utrecht University Padualaan 8 3584 CH Utrecht The Netherlands P: +31-30-2539931 F: +31-30-2537623
______________________________________________ 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.