Displaying 2 results from an estimated 2 matches for "grayclr".
2006 Jan 07
2
need palette of topographic colors similar to topo.colors()
...avior.
#---unsatisfactory topo.colors() behavior
topoclr <- function(tgt)
{
clr <- topo.colors(length(tgt))
clr <- clr[round(rank(tgt),0)]
plot(tgt,pch=15,col=clr)
}
par(mfrow=c(2,1)) ; topoclr(-50:50) ; topoclr(-20:80)
An acceptable solution would be something like this
grayclr <- function(tgt)
{
tgt <- sort(tgt) ; neg <- which(tgt < 0)
clrneg <- gray(0:length(tgt[neg])/length(tgt[neg]))
clrpos <- gray(length(tgt[-neg]):0/length(tgt[-neg]))
clr <- c(clrneg,clrpos)
plot(tgt,pch=15,col=clr)
}
par(mfrow=c(2,1)) ; grayclr(-50:50) ; grayclr...
2006 Jan 09
0
need palette of topographic colors similar to topo.colors ()
...> topoclr <- function(tgt)
> {
> clr <- topo.colors(length(tgt))
> clr <- clr[round(rank(tgt),0)]
> plot(tgt,pch=15,col=clr)
> }
> par(mfrow=c(2,1)) ; topoclr(-50:50) ; topoclr(-20:80)
>
> An acceptable solution would be something like this
> grayclr <- function(tgt)
> {
> tgt <- sort(tgt) ; neg <- which(tgt < 0)
> clrneg <- gray(0:length(tgt[neg])/length(tgt[neg]))
> clrpos <- gray(length(tgt[-neg]):0/length(tgt[-neg]))
> clr <- c(clrneg,clrpos)
> plot(tgt,pch=15,col=clr)
> }
> par(m...