3
我有一个情节,我需要调整连续的传奇。我该怎么做?如何在R中调整图例中的图例?
plot(x,y)
legend(c("x","y"))
我需要的传说应该是在一行
----- x --------- y
问候
我有一个情节,我需要调整连续的传奇。我该怎么做?如何在R中调整图例中的图例?
plot(x,y)
legend(c("x","y"))
我需要的传说应该是在一行
----- x --------- y
问候
你想设置horiz=TRUE
在legend
。以下是默认行为(horiz=FALSE
)与horiz=TRUE
的比较。
此图是根据the second example from the legend
documentation:
layout(matrix(1:2,nrow=1))
# `horiz=FALSE` (default behavior)
plot(x, sin(x), type = "l", ylim = c(-1.2, 1.8), col = 3, lty = 2, main="horiz=FALSE (Default)")
points(x, cos(x), pch = 3, col = 4)
lines(x, tan(x), type = "b", lty = 1, pch = 4, col = 6)
legend(-1, 1.9, c("sin", "cos", "tan"), col = c(3, 4, 6),
text.col = "green4", lty = c(2, -1, 1), pch = c(NA, 3, 4),
merge = TRUE, bg = "gray90")
# `horiz=TRUE`
plot(x, sin(x), type = "l", ylim = c(-1.2, 1.8), col = 3, lty = 2, main="horiz=TRUE")
points(x, cos(x), pch = 3, col = 4)
lines(x, tan(x), type = "b", lty = 1, pch = 4, col = 6)
legend(-1, 1.9, c("sin", "cos", "tan"), col = c(3, 4, 6),
text.col = "green4", lty = c(2, -1, 1), pch = c(NA, 3, 4),
merge = TRUE, bg = "gray90", horiz=TRUE)
你能提供一个[重复的例子(http://stackoverflow.com/questions/5963269/how-to-make-a例如,你使用的数据是否是可重复的?也许可以链接到一个看起来像你正在创建的图表的链接。韩国社交协会。 –