你必須確保劇情足夠寬,否則一些休息時間將被省略。請參閱下面的示例以瞭解其差異。
實施例1:
png(filename = 'scatterplot1.png', width = 800, height = 400)
plot(Ahm5 ~ days, dat, col = 'blueviolet', type = "p", pch = 1, cex=.5, xlab = "Year", xaxt='n', ylab = "Rainfall (mm/Day)")
axis.Date(side = 1, at = seq(as.Date("1961/1/1"), by = "year", length.out = 47))
dev.off()
給出:
實施例2:
png(filename = 'scatterplot2.png', width = 600, height = 300)
plot(Ahm5 ~ days, dat, col = 'blueviolet', type = "p", pch = 1, cex=.5, xlab = "Year", xaxt='n', ylab = "Rainfall (mm/Day)")
axis.Date(side = 1, at = seq(as.Date("1961/1/1"), by = "year", length.out = 47))
dev.off()
給出:
實施例3:
png(filename = 'scatterplot3.png', width = 400, height = 200)
plot(Ahm5 ~ days, dat, col = 'blueviolet', type = "p", pch = 1, cex=.5, xlab = "Year", xaxt='n', ylab = "Rainfall (mm/Day)")
axis.Date(side = 1, at = seq(as.Date("1961/1/1"), by = "year", length.out = 47))
dev.off()
給出:
正如可以看到斷曲線和R選擇打破使用不同。爲了擁有更好的休息,你可以使用:
png(filename = 'scatterplot4.png', width = 800, height = 400)
plot(Ahm5 ~ days, dat, col = 'blueviolet', type = "p", pch = 1, cex=.5, xlab = "Year", xaxt='n', ylab = "Rainfall (mm/Day)")
axis.Date(side = 1, at = seq(as.Date("1965/8/1"), by = "5 year", length.out = 9))
dev.off()
這給:
現在您有:
UPDATE:上的最後一個示例的進一步的闡述:
png(filename = 'scatterplot5.png', width = 800, height = 400)
plot(Ahm5 ~ days, dat, col = 'blueviolet', type = "p", pch = 1, cex=.5,
xlab = "Year", xaxt='n', ylab = "Rainfall (mm/Day)")
axis.Date(side = 1,
at = c(seq(as.Date("1960/8/1"), by = "10 year", length.out = 5),
as.Date('2007-08-01')))
dev.off()
其給出:
請包括[再現的示例](HTTP:/ /stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610)。這使得其他人更容易幫助你。 – Jaap
使用我使用的數據和代碼編輯。 – ajilesh