完成上机3布置的内容,并上交1:编程脚本;2:需要读取的数据(如果有)。注意:1、你需要保证能够顺利地通过代码复现给出的示意图。2、把需要读取的文件和编程脚本放在同一路径下,读取数据的时候,不要添加路径,直接读取文件。这样能够保证传送到我这里的文件能够直接运行,而不需要修改路径。3、不要使用setwd函数,以免在他人不知情的情况下更改路径。
完成ggplot2 2-6章的读书笔记,提交编程脚本。以下仅为示意(你的笔记不需要展示具体的图形结果,只需包括代码及文字注释即可):
library(ggplot2)
## Warning: 程辑包'ggplot2'是用R版本4.2.3 来建造的
###-------------------------------------geom_point 散点图------------------------------------###
ggplot()+
geom_point(data = mtcars,
mapping = aes(x = mpg,y = disp)) ####散点图的几何对象为geom_point
###重要的参数包括shape, size, color, alpha
ggplot()+
geom_point(data = mtcars,
mapping = aes(x = mpg,y = disp, shape = factor(am))) ###shape 控制散点形状,适用于传入分类型变量
ggplot()+
geom_point(data = mtcars,
mapping = aes(x = mpg,y = disp, size = wt)) ###size 控制散点大小,适用于传入连续型变量
ggplot()+
geom_point(data = mtcars,
mapping = aes(x = mpg,y = disp, color = wt)) ###color 控制散点颜色,分类型变量和离散型变量都适用
###数据量较大,散点过多,过于密集的情况下,可以使用alpha参数进行透明化。
diamonds
## # A tibble: 53,940 × 10
## carat cut color clarity depth table price x y z
## <dbl> <ord> <ord> <ord> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
## 1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43
## 2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31
## 3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31
## 4 0.29 Premium I VS2 62.4 58 334 4.2 4.23 2.63
## 5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75
## 6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48
## 7 0.24 Very Good I VVS1 62.3 57 336 3.95 3.98 2.47
## 8 0.26 Very Good H SI1 61.9 55 337 4.07 4.11 2.53
## 9 0.22 Fair E VS2 65.1 61 337 3.87 3.78 2.49
## 10 0.23 Very Good H VS1 59.4 61 338 4 4.05 2.39
## # ℹ 53,930 more rows
ggplot()+
geom_point(data = diamonds,
mapping = aes(x = carat,y = price))
ggplot()+
geom_point(data = diamonds,
mapping = aes(x = carat,y = price), alpha = 0.1)
ggplot()+
geom_point(data = diamonds,
mapping = aes(x = carat,y = price), alpha = 0.01)
###-------------------------------------geom_boxplot 箱线图------------------------------------###
###。。。。。。。。。
完成复杂数据研究的可视化展示,提交word文档。其中,你需要:1、列明标题;2、说明研究的主题、内容是什么;3、使用了什么样的分析方法;4、将研究过程、研究结果进行可视化展示(注意可视化图片的合并、编辑);5、对图片内容进行文字解释。