r - Symbol with white background in plot legend (pt.bg has no effect) -
i'm trying add legend plot, cannot pch symbol fill white. pt.bg
seems have no effect:
plot(1, 1) legend( x = "topright", legend = c("alle messzeitpunkte", "ohne selbstinitiierte", "erwartete"), lty = c("solid", "dashed", "dotted"), pch = c(16, 1, na), pt.bg = c("black", "white", na) )
pch = 1
empty circle , cannot filled. pch = 16
filled shape without border. color both pch = 1
, pch = 16
defined col
. pch = 21
can filled color different border color. color of filling of pch = 21
defined bg
in many plotting functions , pt.bg
in legend()
.
plot(1:10, rep(1, 10), ylim = c(0, 2), axes = false) legend( x = 1, y = 2, legend = c("a", "b", "c", "d", "e"), lty = "solid", pch = c(1, 1, 1), col = c("black", "black", "red", "red", "red"), pt.bg = c("black", "white", "red", "green", "blue") ) legend( x = 2.5, y = 2, legend = c("a", "b", "c", "d", "e"), lty = "solid", pch = c(16, 16, 16), col = c("black", "black", "red", "red", "red"), pt.bg = c("black", "white", "red", "green", "blue") ) legend( x = 4, y = 2, legend = c("a", "b", "c", "d", "e"), lty = "solid", pch = c(21, 21, 21), col = c("black", "black", "red", "red", "red"), pt.bg = c("black", "white", "red", "green", "blue") )
Comments
Post a Comment