Kaja
Kaja

Reputation: 3057

Changing x-Axis in r

I would like to change x-axis of a plot in r. For example:

r<-c(1:10)
plot(r)
axis(1,at=10/(1:10),labels=NULL)

but I see the old values on the x-axis too. I want to have only new values on x-axis.What should I do to?

Upvotes: 1

Views: 206

Answers (1)

cenka
cenka

Reputation: 221

You should use axes argument in plot function and frame.plot argument if you want your plot to have a border, for example:

r<-c(1:10)
plot(r, axes=FALSE, frame.plot=TRUE)
axis(1, at=10/(1:10), labels=NULL)
axis(2, at=axTicks(2), axTicks(2))

Upvotes: 4

Related Questions