Jan Malte Wiener wrote:>
> hi,
> i am using the barplot function, but i have problems with the plot
> region when adjusting the bar width manually. if you only want to plot 2
> bars the default barwidth is to wide (aesthetically speaking). by
> adjusting width and xlim one can actually produce narrow bars, but then
> the plotted graph is not in the center of the plot region, which means
> that for example the title of the plot isn't centered above the
barplot.
>
> e.g.
> toPlot<-c(5,6)
> barplot(toPlot, width=c(0.4), xlim=c(0,3))
> title(main = "Female - Male", font.main=2)
>
> any ideas how to get rid of this problem ??
barplot() returns the x locations, so just call it two times (the second
time more fuzzy) as follows, or look at the code how the locations are
calculated internally.
temp <- barplot(toPlot, width = 0.4)
barplot(toPlot, width = 0.4, xlim = mean(temp) + c(-2, 2))
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._