Jessica Yang
Jessica Yang

Reputation: 155

How to plot just one axis label in R?

A beginner question: I currently have some plots that look like this.

plot with no labels

I'm keeping the plots free of other annotation because I have to fit a lot of them onto one page and specific values aren't important, just the general trend that the red line is to the right of the black one. However, I'd like to be able to indicate that the dashed line in my plot actually represents zero, like so:

plot with zero on x-axis

Is there any way to tell R to only display that value on the x-axis labels? I don't think using text() would be a good idea because it relies on absolute coordinates, but I'm not really sure how to work with axis options to make it do what I want.

Upvotes: 0

Views: 434

Answers (1)

Tyler
Tyler

Reputation: 10032

Try:

axis(side = 1, at = 0)

See ?axis for details.

Upvotes: 2

Related Questions