如何使用 IDPmisc 在对数 r 图中获得漂亮的箭头?
How to get nice arrowheads in logarithmic r plot using IDPmisc?
我想用 IDPmisc 或其他库在对数 r 图中绘制实心箭头。箭头按对数方向拉伸。
一个简单的例子(文档示例稍作修改)是:
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")
我尝试定义一个新的 Arrows.log(就像完成的那样 here)并更改角度:
deg.arr <- c(atan2(y.arr, exp(x.arr)), NA)
theta <- atan2((y2 - y1) * uin[2], exp((x2 - x1)) * uin[1])
但它没有用(我没有完全理解 Arrows 函数)并且 Arrows 中使用的 xyinch() 函数已经出现问题。
如果您建议一种简单的方法来在对数图中绘制带有实心箭头的漂亮箭头而无需重新定义 IDPmisc 箭头,我会很高兴。
你有没有尝试过类似下面的东西
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")
它似乎有效。不过,这可能不是最好的方法。
输出
我想用 IDPmisc 或其他库在对数 r 图中绘制实心箭头。箭头按对数方向拉伸。
一个简单的例子(文档示例稍作修改)是:
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")
我尝试定义一个新的 Arrows.log(就像完成的那样 here)并更改角度:
deg.arr <- c(atan2(y.arr, exp(x.arr)), NA)
theta <- atan2((y2 - y1) * uin[2], exp((x2 - x1)) * uin[1])
但它没有用(我没有完全理解 Arrows 函数)并且 Arrows 中使用的 xyinch() 函数已经出现问题。
如果您建议一种简单的方法来在对数图中绘制带有实心箭头的漂亮箭头而无需重新定义 IDPmisc 箭头,我会很高兴。
你有没有尝试过类似下面的东西
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")
它似乎有效。不过,这可能不是最好的方法。
输出