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

markm0705 markm0705 at gmail.com
Thu Sep 15 10:59:07 CEST 2011


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?

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.



More information about the R-help mailing list