[R] Move the x-axis labels to the top of the dotplot

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Sep 16 09:40:50 CEST 2011


On Thu, Sep 15, 2011 at 2:29 PM, markm0705 <markm0705 at gmail.com> wrote:
> Dear R helpers
>
> I would like to move the x-axis labels, which plot automatically at the base
> of a dot plot to the top of the plot. Is there a way to do this?

Use 'alternating=2' in scales:

   scales = list(x = list(log = 10, alternating = 2)),

-Deepayan

>
> Code snippet below
>
> with(Cal_dat,
>    dotplot(reorder(paste(Mine,Company), Resc_Gt) ~ Resc_Gt,
>            fill_var = Commodity,
>            pch_var = factor(Year),
>                xlab_var = factor(Company),
>            pch = c(21, 22, 23),
>            cex=sym.siz,
>            col = "black",
>            fill = col.pat,
>                alpha=0.6,
>            legend = list(inside = list(fun = mkey,corner = c(0.97, 0.06))),
>                scales = list(x = list(log = 10)),
>                xscale.components = xscale.components.log10ticks,
>            origin = 0,
>            type = c("p","a"),
>            main = "Mineral resources",
>            xlab= "Total tonnes (billions)",
>            panel = function(x, y, ..., subscripts,
>                             fill, pch, fill_var, pch_var) {
>                pch <- pch[pch_var[subscripts]]
>                fill <- fill[fill_var[subscripts]]
>                    panel.ablineq(v=log(ave_dat[1,2]),col="grey60", lty=1, rotate=
> TRUE,label="2002", at=0.40)
>                    panel.ablineq(v=log(ave_dat[2,2]),col="grey60", lty=1, rotate=
> TRUE,label="2009", at=0.50)
>                    panel.ablineq(v=log(ave_dat[3,2]),col="grey60", lty=1, rotate=
> TRUE,label="2010", at=0.60)
>                panel.dotplot(x, y, pch = pch, fill = fill, ...)
>
>            }))
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Move-the-x-axis-labels-to-the-top-of-the-dotplot-tp3815034p3815034.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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