Reputation: 67
I would like help with rotating the axis label for the following plot. As is currently set up, the final label is not displayed because of limited space. I understand text, srt codes are used for this purpose but have not been able to rotate the labels that are currently shown (new numbers instead emerged IN the graph itself):
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")
Upvotes: 3
Views: 17716
Reputation: 986
try adding 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)
Upvotes: 2