[R] How to change color the default in levelplot() ?
jim holtman
jholtman at gmail.com
Mon Nov 9 13:55:19 CET 2009
Here is an example of how I do it using the 'col.regions' parameter:
# create color palette
col.l <- colorRampPalette(c('blue', 'green', 'purple', 'yellow', 'red'))(30)
levelplot(aisle ~ store * pog, storePOG, col.regions=col.l,
cuts=diff(range(as.numeric(as.character(storePOG$aisle)), na.rm=TRUE)),
scales=list(x=list(rot=90, cex=0.5)),
panel=function(x, y, subscripts, ...){
panel.levelplot(x, y, subscripts, ...)
ltext(x,y,storePOG$lr[subscripts], fontface="bold", cex=.6)
},
xlab="Store", ylab="Planogram", main="Physical Aisle Locations")
On Sun, Nov 8, 2009 at 10:15 PM, BabyL BabyK <babyl.babyk at yahoo.com> wrote:
> Dear R communities
>
> May I seek your advices on how to change color the default in levelplot(), e.g. from the default of pink and light blue, to e.g. red and green ?
> The levelplot function has 1 of the arguments being panel (which is actually panel.levelplot), but I am not sure where the commands to alter the color.
>
> For example, I type:
> p1<-levelplot(my.mat,colorkey=FALSE),
> how could I include col.regions of panel.levelplot?
> And whether it is right to use the col.regions?
>
> I am using R 2.8.1 in ubuntu.
>
> Many thanks and have a good day!
>
>
>
>
> [[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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list