Tulisan Jujur
Tulisan Jujur

Reputation: 41

Change size axis plot in R

Hello how to change size axis plot in R

plot(c(imf[1,]), ylim=c(-100, 100),type="l", col="blue")

And the result is enter image description here

I want axis is sequence 1:36, not (0, 5, 10, 20, 25, 30, 35) but (1,2,3,4,5,6,7,.....36)

Upvotes: 1

Views: 3533

Answers (2)

Pierre Lapointe
Pierre Lapointe

Reputation: 16277

Suppress the x-axis with xaxt = "n" and add it back with your own axis.

plot(runif(36), type="l",col="blue", xaxt = "n", cex.axis=0.7)
axis(1, at=1:36, labels=1:36,cex.axis=0.7)

enter image description here

Upvotes: 0

agstudy
agstudy

Reputation: 121568

You should axis. But it is optimized to not overlap overlap previously drawn labels, so here I am playing with cex parameter (depends on you window size) to show all labels.

plot(1:36, rnorm(36), axes = FALSE)
axis(1, 1:36, 1:36,cex.axis=0.5)

enter image description here

Upvotes: 1

Related Questions