0

I have created my bar plot in R and am moving on from using two-bar plots to three-bars.

I want to label the bars '1','2' and '3'along the x-axis

I understand how to use the axis function, and also that the 'at' function requires a numeric value or vector, it's just thatI don't know exactly what value it is that it requires!

Thanks very much in advance

emma
  • 3
  • 2
  • 2
    Hi and welcome to SO! People are much more happy to help if you provide a [**minimal, reproducible example**](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) together with the code you have tried. Thanks! – Henrik Dec 13 '13 at 20:58
  • Thanks Henrik, I will try and do that next time – emma Dec 13 '13 at 21:28

1 Answers1

1

Great news! You can use whatever values you like!

mat <- matrix(c(14,9,7))
barplot(mat[ ,1])
axis(1, at = c(.5,1.5,3.5), labels = 1:3, tick = FALSE, las = 2)
rawr
  • 20,481
  • 4
  • 44
  • 78
  • 1
    thankyou so much, from your example I was able to see exactly what the 'at' function was requiring of me. I was able to manipulate the numbers you provided to place the labels where I wanted. My project is due Monday and you have been a great help - thank you – emma Dec 13 '13 at 21:33