[R] Order of Dotplot output

jim holtman jholtman at gmail.com
Fri Oct 19 19:46:37 CEST 2007


Check out 'as.table' option in the help file.

On 10/19/07, Allison Bailey <allison at soundgis.com> wrote:
> I'm just learning to work with R, and am having some difficulty controlling the output of my dotplot.
>
> The default order of the function dotchart seems to be the largest value on the bottom and the smallest on the top.  I wanted it in the opposite order (which is how my data frame is currently sorted), so I used the following approach, which works
>
> orderidx <- order(b2000$RR)
> dotchart(b2000$RR[orderidx], labels = b2000$CNAME[orderidx],cex=0.5,xlab = "Proportion of Annual Catch, 2000")
>
> However, the default behavior of the dotplot function (within the lattice library) seems to be to order the data in reverse alphabetical order (A on the bottom, Z on the top).  Can someone provide suggestions for controlling this order?  I would either prefer largest value (top) to smallest value (bottom) or alphabetical order (A top, Z bottom).
>
> In addition, is there a way to control the labeling of each subplot?   When I use the following code:
>
> dotplot(CNAME ~ RR | RYEAR, data = btwlSubset, xlab = "% of annual catch ")
>
> each subplot gets labeled with the word "RYEAR", rather than the value contained within the RYEAR column, which is what I would like.
>
> Thanks for any suggestions,
>
> Allison
>
> ______________________________________________
> 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 you are trying to solve?



More information about the R-help mailing list