我想用颜色填充散点图上的实心圆点.我试过这个:
> plot(dframe1$TV~dframe1$Books)
> xlab="Number of books read per month"
> plot(dframe1$TV~dframe1$Books,
xlab="Number of books read per month")
> plot(dframe1$TV~dframe1$Books,
xlab="Number of books read per month",
ylab="Hours of TV watched per week",
main="Associations between time spent watching TV and reading",
col.main="red",
cex=1.5,
pch=21,
bg=”light green”)
Error: unexpected input in:
"pch=21,bg=”"
Run Code Online (Sandbox Code Playgroud)
这是行不通的.我很感激建议/帮助.:)
颜色名称没有空格,请尝试"lightgreen"改为
例
set.seed(1) # some random data
x <- rnorm(20, 5)
y <- 2 + .78*x + rnorm(20)
plot(y~x, pch=21, bg="lightgreen")
Run Code Online (Sandbox Code Playgroud)
产生:
