user2918586
user2918586

Reputation: 33

Changing X-axis position in R barplot

I have two values of averages LR50<-(424.8, 425.7). I want to plot these as a barplot barplot(LR50). Now, I don't need any of the information except from ylim=c(424,426.5). When I change the x-axis axis(1,at=c(0,10), pos=424) there is still bar plot that falls below the axis.

How do I get the barplot to only plot from the new x-axis at y=424 and up?

Upvotes: 3

Views: 4231

Answers (1)

mnel
mnel

Reputation: 115485

You will need to use the xpd parameter (and set it to FALSE), this will clip the plot to the plotting region.

barplot(LR50,ylim = c(424,426.5),xpd=FALSE)
axis(1,at=c(0,10),pos=424)

enter image description here

Upvotes: 3

Related Questions