[R] lattice 'scales' option help

Peter Ehlers ehlers at ucalgary.ca
Mon May 24 18:44:49 CEST 2010


On 2010-05-24 9:38, Kim Jung Hwa wrote:
> Hi All,
>
> I'm trying to draw boxplots. I'm having a hard time to get "ticks labels" on
> multiple panels using 'alternating' option.
>
> # R Code:
> # May not be the best example, please just look into 'scales' option
> library(lattice)
> data(OrchardSprays)
> dta<- subset(OrchardSprays, OrchardSprays$rowpos %in% c(1,2,3))
>
> # Original
> # This works fine, as you can see Y-AXIS labels (0,50,100) on both Panel-1
> and Panel-3, and
> # X-AXIS lables (A,B,C,...) on both Panel-1 and Panel-2
> bwplot(decrease ~ treatment | factor(rowpos), data=dta,
>    pch="|",
>    scales=list(y=list(alternating=1)) # default
> )
>
> # Flipping "decrease ~ treatment" TO "treatment ~ decrease"
> # Here somehow 'alternating' option does not work, I'm only getting labels
> (0, 50, 100) on Panel-1 and NOT on Panel-2 as desired
> # I need labels (0,50,100) on first two panels and not 3rd one.
> # Can anyone tell me where I'm going wrong? OR someway to achieve this?
>
> bwplot(treatment ~ decrease | factor(rowpos), data=dta,
>    pch="|",
>    scales=list(y=list(alternating=1))
> )

You've switched x and y; try x=list(alternating).

  -Peter Ehlers

>
> Any help would be highly appreciated, thank you in advance...
>
> Regards,
> Kim
>



More information about the R-help mailing list