6

If I run this simple code:

x <- c(1:10)
y <- c(1:10)
plot(x,y,type="h")

the result contains very thin histogram lines.

my plot

Is there a way to make these lines thicker (other than using the hist() function itself)? They do not necessarily have to look like bars, just be a little thicker.

Clint
  • 900
  • 11
  • 25

1 Answers1

6

Try this:

plot(x,y,type="h", lwd = 4)
thepule
  • 1,721
  • 1
  • 12
  • 22
  • 6
    Add `lend=1` to give squared-off line caps, which look more like bars. Otherwise, the line caps will be rounded, and the rounded part will actually protrude above the top value and below zero. In addition, probably best to add `ylim=c(0,10)` so that the "bars" go down to zero. For example: `plot(x,y,type="h", lwd=20, lend=1, ylim=c(0,10)); lines(x,y, type="h", col="grey60", lwd=10)`. – eipi10 Jun 23 '16 at 22:07
  • @eipi10 Brilliant comment – Celine Harumi Jun 20 '20 at 07:17