Skip to content
Prev 304741 / 398506 Next

Horizontal grid in background of barplot

On 2012-09-03 12:12, David Arnold wrote:
Just plot the bars twice and add the background colour of
the legend region.

  barplot(x,beside=TRUE,
          ylim=c(0,90))

  abline(h=c(seq(10,90,10)))
  box()
  barplot(x,beside=TRUE,
          xlab="Ailment",
          ylab="Percent",
          legend.text=TRUE,
          args.legend=list("topright",title="Treatment",bg="white"),
          add=TRUE)

Peter Ehlers