I would like to draw a hollow histogram that has no vertical bars drawn inside of it, but just an outline. I couldn't find any way to do it with geom_histogram
. The geom_step
+stat_bin
combination seemed like it could do the job. However, the bins of geom_step
+stat_bin
are shifted by a half bin either to the right or to the left, depending on the step's direction=
parameter value. It seems like it is doing its "steps" WRT bin centers. Is there any way to change this behavior so it would do the "steps" at bin edges?
Here's an illustration:
d <- data.frame(x=rnorm(1000))
qplot(x, data=d, geom="histogram",
breaks=seq(-4,4,by=.5), color=I("red"), fill = I("transparent")) +
geom_step(stat="bin", breaks=seq(-4,4,by=.5), color="black", direction="vh")
direction = "mid"
which does just that (see my answer below) – Heartburning