Sabytet
Sabytet

Reputation: 31

How to draw an X axis on a barplot?

I am trying to make the simplest barplot in r and cannot get the x axis to show. I'm not trying to add labels or anything fancy, I literally just want a black line to be there.

I have tried "axis.lty=1", xaxt, lty, axes.lty and none of it has helped. What am I doing wrong?

plantmeans<-c(802,1273,468,1286)
barplot(plantmeans,xlab = "Treatment", ylab = "Time taken to unfurl/secs",axis.lty=1)

Upvotes: 2

Views: 47

Answers (1)

NelsonGon
NelsonGon

Reputation: 13319

Try this:

plot1<-barplot(plantmeans,xlab = "Treatment", ylab = "Time taken to unfurl/secs",axis.lty=4)
axis(1,at=plot1,labels=plantmeans)

Upvotes: 1

Related Questions