簡體   English   中英

R中的旋轉軸標簽

[英]Rotating axis label in R

我想幫助旋轉下圖的軸標簽。 按照當前設置,由於空間有限,未顯示最終標簽。 我理解文本,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")

嘗試添加 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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM