[R] cutting barplots at e.g. 50%

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Mar 15 18:39:14 CET 2002

Jan Malte Wiener wrote:
> hi,
> i want to plot percentage values using barplot. everything works fine so
> far. giving a chance level of 50% i want to plot only the area above 50
> percent.
> i can of course cut  using  ylim=c(50,100) but this does not work
> properly since i also see some of the area below 50%.

Looks like a bug (the problem ist the setting of 'xpd').

What you can do is:
At first substract 50 from your data, then add the axis manually:

 x <-  seq(50,100,10) 	# your data
 xn <- x - 50		# substract 50
 barplot(xn, yaxt="n")  # no axis (would be wrong)
 axis(2, at=0:5 * 10, labels=5:10 * 10) # so adding it manually

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

More information about the R-help mailing list