简体   繁体   中英

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?

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM