我想帮助旋转以下绘图的轴标签。 按照当前设置,由于空间有限,不显示最终标签。我理解文本,srt代码用于此目的,但无法旋转当前显示的标签(新数字反而出现在图表本身):
Xmin=0-2
Xmax=0+2
plot(x, y, type='n', xlab='x-axis',
col.axis="grey", cex.axis=0.7, tck=-.02, xaxt="n")
x <- c(-2,2)
y <- c(-1,1)
plot(x, y, type='n', xlab='x-axis', col.axis="grey", cex.axis=0.7,
tck=-.02, xaxt="n")
abline(a=-.6, b=-.2, lty=1, pch=15, lwd=1, col='black')
abline(a=.03, b=.2, lty=5, pch=15, lwd=1, col='black')
axis(1, at=c(-2, -1, 1.9, 2), labels=c("8.07", "8.976", "11.7",
"11.9"), tck=.01, cex.axis=0.9, srt=45, col.ticks = "grey")
答案 0 :(得分:1)
尝试添加las = 2
axis(1, at=c(-2, -1, 1.9, 2), labels=c("8.07", "8.976", "11.7",
"11.9"), tck=.01, cex.axis=0.9, srt=45, col.ticks = "grey", las=2)