我有两个数据集(每个都有两列数据)。我想使用 R 将两个数据集 xyplot 成一个图形,一个是点形式,一个是平滑线格式。
你介意教我怎么做吗?谢谢。
一般来说:
plot(first_dataset, type="p")
par (new=TRUE)
plot(second_dataset)
你有几个选择:
1)plot
与“o”(overplot)类型一起使用
plot (x, y, t="o")
2)通常,正如@Milktrader 所说,您可以使用 plot 调用两次new=TRUE
,例如:
plot (x, y)
plot (x, y, "l", new=T)
3) 使用points
plot (x, y)
points (x, y, "l")
split.screen
4) 用or分割屏幕layout
split.screen(c(1,2))
screen(1)
plot(x, y)
screen(2)
plot(x, y, "l")
而且肯定还有很多其他的...