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例如,你使用的數據是否是可重複的?也許可以鏈接到一個看起來像你正在創建的圖表的鏈接。韓國社交協會。 –