[R] Combining lines and barplot
Dirk Eddelbuettel
edd at debian.org
Sat Jul 8 22:36:19 CEST 2000
David James was kind enough to help me out and enlighten me to the fact that
the x-scales used by barplot are independent of those from my data. He also
sent me a function which I include below (with a minor modification). This
does exactly what I was looking for. Thanks!
xbarplot <- function(y, col=par("col"), border = par("fg"), gap=gap, ...)
{
ny <- length(y)
x <- seq(0,ny)+0.5
n <- length(x)
space <- gap * mean(diff(x))
old <- par(xaxt = "n")
on.exit(par(old))
plot(range(x, na.rm=T), range(y, na.rm=T), bty="n",
xlab="", ylab = "", type = "n", ...)
rect(x[-n]+space/2, rep(0,length(y)),
x[-1]-space/2, y, col = col, border = border)
}
Regards, Dirk
--
According to the latest figures, 43% of all statistics are totally worthless.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list