简体   繁体   中英

In R plots, how can we make the length of an x-axis several times longer than the y-axis?

Currently, I am trying to stretch out the x-axis of a plot to search for things like seasonality, etc. Meaning, I would possibly like my x-axis to be 6 times or so longer than my y-axis, while keeping the ticks and data the same. An example:

x <- rnorm(20)^2 * 1000000
plot(x)

在此处输入图片说明

Is there a way to make the x-axis above much longer than the y-axis? Thanks!

The commands below are writing it to a .png file with different width. The files fig1.png and fig2.png are saved to your home directory.

png("fig1.png", width = 400, height = 300)
x <- rnorm(20)^2 * 1000000
plot(x)
dev.off()

png("fig2.png", width = 600, height = 300)
x <- rnorm(20)^2 * 1000000 #or leave this out if you want the same data x 
plot(x)
dev.off()

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