[R] lattice-dotplot: resize axis

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Oct 13 11:30:03 CEST 2011


On Wed, Oct 5, 2011 at 5:00 PM, René Mayer
<mayer at psychologie.tu-dresden.de> wrote:
> dear all,
>
> I want to make a dotplot with ratings from Items in 6 ItemsGroups.
> I reordered the items by rating within each group.
> I plotted the items by rating conditional on ItemGroup.
> The ordering works as I wanted but my y-aches labels (items) within each
> ItemGroup are now unequally spaced, e.g., in some panels there is a
> gap between one lower rated item and the next higher, to give a picture
>
> items=a,e,f,g
>
> ItemGroup=n
> -----------------
> g|      .
> f|   .
> e|  .
>  |
>  |
>  |
> a| .
> -----------------
>
>
> How can I correct this? What have I overlooked?

A reproducible example would help.

-Deepayan

>
> # code i've used (from latticeExtra/utilities/resize panels)
> library(latticeExtra)
>
>
> mean.ratings$item.name <-
>    with(mean.ratings, reorder(reorder(item, rating),
>                        as.numeric(ItemGroup)))
> dpratings <-
>    dotplot(item.name ~ rating | reorder(ItemGroup, rating),
>            data = mean.ratings, layout = c(1, 6), xlim=c(1,6),
>            aspect = .1,
>            scales = list(y = list(relation = "free", cex=.5)))
>
> ## approximate
> resizePanels(dpratings,
>             h = with(mean.ratings, table(reorder(ItemGroup, rating))))
>
> thanks,
> René
>
> ______________________________________________
> 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