最后一步报错

来源:3-3 R语言 基本绘图系统之实践

噗噗姑娘

2016-04-16 00:03

hist(airquality$Wind,xlab="wind")

boxplot(airquality$Wind,xlab="wind",ylab="speed(mph)")

plot(airquality$Wind,airquality$Temp)

with(airquality,plot(Wind,Temp,main="Wind and Temp in NYC"))

title(main="Wind and Temp in NYC")


with(airquality,plot(Wind,Temp,

                     main="Wind and Temp in NYC",

                     type = "n"))

with(subset(airquality,Month==9),

     points(Wind,Temp,col = "red"))

with(subset(airquality,Month==5),

     points(Wind,Temp,col = "blue"))

with(subset(airquality,Month==8),

     points(Wind,Temp,col = "black"))


with(subset(airquality,Month %in% c(6,7,8)),

     points(Wind,Temp,col = "black"))

fit <- lm(Temp ~ Wind,airquality)

abline(fit,lwd=2)

legend("toprint",pch=1,

       col=c("red","blue","black"),

       legend=c("Sep","May","other"))


Error in match.arg(x, c("bottomright", "bottom", "bottomleft", "left",  : 

  'arg' should be one of “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right”, “center”


写回答 关注

1回答

  • 无无法师
    2016-07-11 12:10:09

    你打的是legend("toprint",pch=1,

    提示说了,应该是topright,属于打字出错

R语言之数据可视化

R语言三大绘图系统,用图形直观探索数据、发现有价值信息

39089 学习 · 137 问题

查看课程

相似问题