Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让R在散点图上用颜色填充圆点?_R - Fatal编程技术网

如何让R在散点图上用颜色填充圆点?

如何让R在散点图上用颜色填充圆点?,r,R,我想用颜色填充散点图上的实心圆点。 我试过这个: > 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

我想用颜色填充散点图上的实心圆点。 我试过这个:

>  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=”"
它不起作用。
我将感谢您的建议/帮助。:)

颜色名称没有空格,请尝试使用“浅绿色”

范例

set.seed(1) # some random data
x <- rnorm(20, 5)
y <- 2 + .78*x + rnorm(20)
plot(y~x, pch=21,  bg="lightgreen")
set.seed(1)#一些随机数据

请看一下
的文档?点
,它描述了所有不同的
pch
值。您还试图在
浅绿色
周围传递智能(卷曲)引号。R不知道如何解释它们。我认为柯利引号实际上是引发错误的原因,因为如果是空格,则错误消息将包含单词
light
(以及开头的柯利空格)。谢谢。你可能是对的。我会更加小心的。:-)谢谢你,吉尔伯,这很有帮助。:-)哦,还有一件事,你介意告诉我如何在R:xTry`,main=bquote(下划线(((.(.(.(.学生看电视和阅读的时间之间的关联))中的标题下划线吗,…并且一定要阅读?plotmath和?bquote。谢谢你,DWin,它看起来真的很好。-)我已经看过了?plotmath,但我真的不明白?bquote和(。