1

I would like to draw filled arrowheads in a logarithmic r plot with IDPmisc or another library. The arrowheads are stretched logarithmically.

A simple example (the documentation example slightly modified) is:

library(IDPmisc)

plot(c(4,10), c(0,10), type="n",log = "x")
Arrows(5, 5, 5,10, size=3,
   sh.lwd=5, sh.lty=2,
   h.lwd=5)
Arrows(5, 5, 7.5, 9, size=3, open=TRUE,
   sh.adj=0.7, sh.lwd=5, sh.lty=2,
   h.col.bo="red",h.lwd=5)
Arrows(5, 5, 9, 7.5, size=3, open=FALSE,
   sh.adj=1, sh.lwd=5, sh.col="blue",
   h.col.bo="red",h.lwd=2)
Arrows(5, 5, 10, 5, size=2.5, width=1.5, open=FALSE,
   sh.adj=1, sh.lwd=7, sh.col="blue")

I tried to define a new Arrows.log (like it was done here) and change the angles:

deg.arr <- c(atan2(y.arr, exp(x.arr)), NA)
theta <- atan2((y2 - y1) * uin[2], exp((x2 - x1)) * uin[1])

But it didn't work (I didn't understand the Arrows function completely) and already had problems with the xyinch() function used in Arrows.

If you suggest an easy method to draw nice arrows with filled heads in a logarithmic plot without redefining the IDPmisc Arrows, I would be happy.

Community
  • 1
  • 1
eve
  • 25
  • 5

1 Answers1

0

Have you tried something like the following

plot(log10(c(4,10)), c(0,10), type="n")
Arrows(log10(5), 5, log10(5),10, size=3,
   sh.lwd=5, sh.lty=2,
   h.lwd=5)
Arrows(log10(5), 5, log10(7.5), 9, size=3, open=TRUE,
      sh.adj=0.7, sh.lwd=5, sh.lty=2,
      h.col.bo="red",h.lwd=5)
Arrows(log10(5), 5, log10(9), 7.5, size=3, open=FALSE,
      sh.adj=1, sh.lwd=5, sh.col="blue",
      h.col.bo="red",h.lwd=2)
Arrows(log10(5), 5, log10(10), 5, size=2.5, width=1.5, open=FALSE,
      sh.adj=1, sh.lwd=7, sh.col="blue")

It seemed to work. It may not be the best way to do it though.

Output

enter image description here

steveb
  • 5,382
  • 2
  • 27
  • 36