2016-12-04 199 views
0

有沒有一種方法可以在基本R中通過旋轉它們來修改點類型?我需要一個指向直角三角形(底部平行於Y軸)。R plot旋轉點或填充箭頭

x <- runif(5) 
y <- runif(5) 
plot(x, y, pch = 17, cex = 2) #is there a parameter for rotation? 

或者,我怎樣才能改變箭頭()中的箭頭與實心三角形?

plot(x, y, pch = "") 
arrows(x, y, x-0.03, y, code = 1) #is there a parameter for the arrowhead symbol? 

感謝您的幫助!

薩拉

+1

看吧:http://stackoverflow.com/questions/5731432/change-arrowhead-of-arrows – Marichyasana

+0

'PCH = -9658'(也許取決於執行環境) – cuttlefish44

+0

謝謝! @ cuttlefish44的解決方案是我尋找的簡單方法:) – Sara

回答

1

至少在我的Windows環境,pch可以利用幾乎所有的字符WGL4包含。例如,BLACK RIGHT-POINTING POINTERpch = -9658,pch = -as.hexmode("25BA")pch = "\U25BA"繪製。您可以從Using special characters from Windows Glyph List 4 (WGL4) in HTML獲取字符代碼。例如

;
plot(rep(1, 9), pch = -c(9658, 9668, 9674, 9688, 9689, 9786, 9788, 9824, 9827), cex = 2) 

enter image description here