问答详情
源自:3-3 R语言 基本绘图系统之实践

最后一步报错

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”


提问者:噗噗姑娘 2016-04-16 00:03

个回答

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

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

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