Re: [R] issue with plot (type="h")

From: Manuel Morales <Manuel.A.Morales_at_williams.edu>
Date: Thu 23 Feb 2006 - 01:31:21 EST

Hi Gašper

On Wed, 2006-02-22 at 14:12 +0100, Gasper Cankar wrote:
> Hello everyone.
>
> For reasons too long to explain I wanted to do plots similar to histograms with plot(type="h").
> I ran into a problem - if I set line width too high, histogram isn't accurate anymore.
>
> For example:
>
> par(lend=2)
> plot(c(2,4,3,2),ylim=c(0,5), type="h")
> abline(h=3)
>
> Column 3 appears just as high as it should. But if I do
>
> par(lend=2)
> plot(c(2,4,3,2),ylim=c(0,5), type="h",lwd=100)
> abline(h=3)
>
> then columns become too high. Can I correct the problem or is there another way to display my data correctly?

You need to use lend=1 or lend="butt" in your par() statement.

In my view, it would be nice to change the default to use lend=1 for plot type = h, or at least to include a warning when square is used, since the effect of increasing the lwd may not always be obvious.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Feb 23 02:40:07 2006

This archive was generated by hypermail 2.1.8 : Thu 23 Feb 2006 - 06:23:11 EST