Felix: Thank you! Perhaps I should read documentation more careful as I missed that another `at`. lattice & latticeExtra are so marvelous so I hardly want to use anything else.
Mikhail On 08/13/2011 07:31 AM, Felix Andrews wrote: > You can just specify the label positions, you don't need to give > labels for every color change point: > (there is an 'at' for the color changes and a 'labels$at' for the labels) > > levelplot(rnorm(100) ~ x * y, expand.grid(x = 1:10, y = 1:10), > colorkey = list(at = seq(-3,3,length=100), > labels = list(labels = paste(-3:3, "units"), at = -3:3))) > > > > On 13 August 2011 19:59, Jim Lemon <j...@bitwrit.com.au> wrote: >> On 08/13/2011 04:34 AM, Mikhail Titov wrote: >>> Hello! >>> >>> I’d like to have a continuous color bar on my lattice xyplot with colors >>> lets say from topo.colors such that it has ticks& labels at few specific >>> points only. >>> >>> Right now I use do.breaks& level.colors with somewhat large number of >>> steps. The problem is that color change point doesn’t necessary correspond >>> to the value I’d like to label. Since I have many color steps and I don’t >>> need high precision I generate labels like this >>> >>> labels<- ifelse( sapply(at,function(x) any(abs(att-x)<.03)) , >>> sprintf("depth= %s ft", at), "") >>> >>> , where `att` has mine points of interest on color scale bar and `at` >>> corresponds to color change points used with level.colors . It is a bit >>> inconvenient as I have to adjust threshold `.03`, number of color steps so >>> that it labels only adjacent color change point with my labels. >>> >>> Q: Are there any ready to use functions that would generate some kind of >>> GRaphical OBject with continuous color scale bar/key with custom at/labels >>> such that it would work with `legend` argument of xyplot from lattice? >>> >> Hi Mikhail, >> I think that color.legend in the plotrix package will do what you are >> asking, but it is in base graphics, and may not work with lattice. >> >> Jim >> >> ______________________________________________ >> R-help@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. >> > > ______________________________________________ R-help@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.