[R] Level Plot and Scale of Colorkey

Toby Marthews Toby.Marthews at lsce.ipsl.fr
Fri Jun 13 19:07:39 CEST 2008


Try

colscaledivs=100		#colscaledivs=15 here is the R default
levelplot(z ~ x * y, g,xlab="x co-ordinate",ylab="y
co-ordinate",colorkey=TRUE,at=seq(from=-0.01,to=0.25,length=colscaledivs),col.regions=(col=gray((0:colscaledivs)/colscaledivs)))

Toby Marthews


Le Ven 13 juin 2008 18:50, emma hartnett a écrit :
> I am drawing level plots but I would like to specify the range of the
> colorkey, I am not having any success figuring this out so any help would
> be greatly appreciated!
>
> Here is an example of what I am trying to do:
>
> disp<-1
>
> x <- seq(1, 10,by=1)
> y <- seq(1,10,by=1)
> g <- expand.grid(x = x, y = y)
> g$z <- 1/exp((abs(g$x-5)+abs(g$y-5))*disp)
> g$z<-g$z/sum(g$z)
>
> levelplot(z ~ x * y, g,xlab="x co-ordinate", ylab="y co-ordinate"
> ,colorkey=TRUE,col.regions=(col=gray((0:32)/32)))
>
> I would like to enforce the number of divisions on the colorkey scale and
> the size – so for example from 0 to 0.1 in increments of 0.02 (just as an
> example).
>
> I apologize if this is an obvious question but I have read the
> documentation and scoured the archives and cannot figure it out.
>
>
>
>
>       __________________________________________________________
> can.html
>
> ______________________________________________
> 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.



More information about the R-help mailing list