在 base R plot 中,如何将多个 pch 部署到同一个符号?
In base R plot, how can deploy multiple pchs to the same symbol?
plot(1, pch = 19, cex = 3, col = "red")
points(1, pch = 1, cex = 3, col = "black", lwd = 2)
legend("top",
"sym",
pch = 19,
col = "red",
cex = 2,
pt.cex = 4)
legend("top",
"sym",
pch = 1,
col = "black",
cex = 2,
pt.cex = 4)
在 R 中,可以将黑色边框添加到实心红色圆圈中,例如:
那么,如何使用添加类型的符号作为图例?
如代码所示,图例不能添加,只能重叠。
谢谢。
使用bty = "n"
plot(1, pch = 19, cex = 3, col = "red")
points(1, pch = 1, cex = 3, col = "black", lwd = 2)
legend("top",
"sym",
bty = "n",
pch = 19,
col = c("red"),
cex = 2,
pt.cex = 4)
legend("top",
"sym",
bty = "n",
pch = 1,
col = c("black"),
cex = 2,
pt.cex = 4)
由 reprex package (v0.2.1)
创建于 2019-02-14
另一个选项是使用与background
选项一起使用的pch符号,它只能在pch = 21:25时使用。
plot(1, pch = 19, cex = 3, col = "red")
points(1, pch = 1, cex = 3, col = "black", lwd = 2)
legend("top",
"sym",
pch = 21,
pt.bg="red",
cex = 2,
pt.cex = 4)
plot(1, pch = 19, cex = 3, col = "red")
points(1, pch = 1, cex = 3, col = "black", lwd = 2)
legend("top",
"sym",
pch = 19,
col = "red",
cex = 2,
pt.cex = 4)
legend("top",
"sym",
pch = 1,
col = "black",
cex = 2,
pt.cex = 4)
在 R 中,可以将黑色边框添加到实心红色圆圈中,例如:
那么,如何使用添加类型的符号作为图例?
如代码所示,图例不能添加,只能重叠。
谢谢。
使用bty = "n"
plot(1, pch = 19, cex = 3, col = "red")
points(1, pch = 1, cex = 3, col = "black", lwd = 2)
legend("top",
"sym",
bty = "n",
pch = 19,
col = c("red"),
cex = 2,
pt.cex = 4)
legend("top",
"sym",
bty = "n",
pch = 1,
col = c("black"),
cex = 2,
pt.cex = 4)
由 reprex package (v0.2.1)
创建于 2019-02-14另一个选项是使用与background
选项一起使用的pch符号,它只能在pch = 21:25时使用。
plot(1, pch = 19, cex = 3, col = "red")
points(1, pch = 1, cex = 3, col = "black", lwd = 2)
legend("top",
"sym",
pch = 21,
pt.bg="red",
cex = 2,
pt.cex = 4)