2016-12-04 201 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