Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.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 为什么ggplot给我一张空白图表?_R_Ggplot2 - Fatal编程技术网

R 为什么ggplot给我一张空白图表?

R 为什么ggplot给我一张空白图表?,r,ggplot2,R,Ggplot2,我想了解为什么我不能用我的代码生成图形。我有 > dput(CWEEM_df) structure(list(scale = c(2L, 3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 7L), CWEEM = c(0.322195198733443, 0.495806796612831, 0.833288896397849, 0.795473436370842, 0.819476963392047, 0.90126867844622, 0.34221

我想了解为什么我不能用我的代码生成图形。我有

> dput(CWEEM_df)
structure(list(scale = c(2L, 3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 
5L, 6L, 7L), CWEEM = c(0.322195198733443, 0.495806796612831, 
0.833288896397849, 0.795473436370842, 0.819476963392047, 0.90126867844622, 
0.342214826198644, 0.464825881280908, 0.725655531611074, 0.720349006361943, 
0.536530647330033, 0.8585486983613), legends = c("kilianindex->MSCI", 
"kilianindex->MSCI", "kilianindex->MSCI", "kilianindex->MSCI", 
"kilianindex->MSCI", "kilianindex->MSCI", "MSCI->kilianindex", 
"MSCI->kilianindex", "MSCI->kilianindex", "MSCI->kilianindex", 
"MSCI->kilianindex", "MSCI->kilianindex")), class = "data.frame", row.names = c(NA, 
-12L))

我得到一个空的图:


为什么?

您需要添加一个
geom…

库(ggplot2)
ggplot(数据=CWEEM_df,aes(x=比例,y=CWEEM,颜色=图例))+
几何点()


由(v2.0.0)于2021-05-03创建。

您需要添加一个
geom…

库(ggplot2)
ggplot(数据=CWEEM_df,aes(x=比例,y=CWEEM,颜色=图例))+
几何点()

由(v2.0.0)于2021年5月3日创建

library(ggplot2)
p=ggplot(data = CWEEM_df, aes(x = scale, y = CWEEM, colour=legends))
plot(p)