【发布时间】:2019-03-27 12:08:11
【问题描述】:
我知道,这是一个非常古老的问题,在 plot.new has not been called yet 等中提到过。但是,那里的答案对我不起作用,所以我不得不再问一遍:
我正在阅读一个包含 30 行数据的简短表格,两个不同的表格:
lines <-scan("Wanna.txt", what="character", sep='\n')
结构如下:
AA BB
5 149
12 5
15 5
100 7
...
AA BB
5 1
10 136
23 150
100 3
然后我将表格读入数据结构:
Wanna5 <- read.table(textConnection(lines[1:5]), header=TRUE)
Wanna15 <- read.table(textConnection(lines[7:11]), header=TRUE)
当我做一个ggplot时,它可以工作
ggplot(data=Wanna5, mapping= aes(x=AA, y=BB)) + geom_line()
当我尝试添加简单的第二个数据集时
lines(Wanna15$AA, Wanna15$BB, type="l", col="green")
它告诉我旧的错误:
Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet
怎么办?
【问题讨论】: