2

is there a way in basic R to modify the pch point types by just rotating them? I´d need a pointing-right triangle (with its base parallel to the y axes).

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

Alternatively, how could I change the arrowhead in arrows() with a filled triangle?

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

thanks for your help!

Sara

Sara
  • 465
  • 5
  • 15

1 Answers1

4

At least in my windows environment, pch can take almost all characters that WGL4 contains. For example, BLACK RIGHT-POINTING POINTER is drawn by pch = -9658, pch = -as.hexmode("25BA"), or pch = "\U25BA". You can get codes of characters from Using special characters from Windows Glyph List 4 (WGL4) in HTML.

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

enter image description here

Community
  • 1
  • 1
cuttlefish44
  • 6,586
  • 2
  • 17
  • 34