[R] barplot: invalid 'xlim' value
Joshua Wiley
jwiley.psych at gmail.com
Sat May 15 19:27:06 CEST 2010
Hello,
It could be my email client (gmail), but I had an error when trying to
paste your data in. Anyway to answer part of your question
> # Draw the histograms
> for (i in 1:length(ages)){
> par(new = TRUE)
> xmin <- -ages[i] + xlim[1]
I think your problem here might be that you have -ages[i] + xlim[1],
or more clearly
xmin <- xlim[1] - ages[i]
My guess is that this is a typo that hides easily because of the
assignment operator. That would explain why it keeps decreasing.
> xmax <- xlim[2] - ages[i]
> ser <- freqs[, i+1]
> ser <- ser/max(ser) * barscale
> barplot(ser, horiz = TRUE, axes = FALSE, xlim = c(xmin, xmax),
> ylim = ylim, col = barcol, space = 0)
> }
Best,
Josh
<snipped the rest>
More information about the R-help
mailing list