1.11-23-1
1 ggplot 常见应用函数
1.1 印射
1.2 分面
1.3 双分面
2.1 几何对象
3.1 完整绘图模板
3.2 ggpubr 图片保存
3.3 eoffice
3.4 patchwork
3.5 常见问题:dev.off
1 ggplot 常见应用函数
1.1 印射:按照数据框的某一列来定义图的某一个属性
1.2 分面
...
ggplot(data = iris) +
geom_point(mapping = aes(x = Sepal.Length, y = Petal.Length)) +facet_wrap(~ Species)
...
1.3 双分面
...
test$group = sample(letters[1:5],150,replace = T)
ggplot(data = test) +
geom_point(mapping = aes(x = Sepal.Length, y = Petal.Length)) +facet_grid(group ~ Species)
...
2.1 几何对象
...
ggplot(data = test) +
geom_smooth(aes(x = Sepal.Length,y = Petal.Length,group = Species))
...
...
ggplot(data = test) +
geom_smooth(aes(x = Sepal.Length,y = Petal.Length,color = Species))
...
以上两个图做出来效果一样,一个是显式分组,一个是隐式分组,即老师直接分成多少组或老师根据学生帽子的颜色分组
2.2 几何对象叠加
...
ggplot(data = test) +
geom_smooth(mapping = aes(x = Sepal.Length, y = Petal.Length))+
geom_point (mapping = aes(x = Sepal.Length, y = Petal.Length))
...
可替换为
...
ggplot(data = test, mapping = aes(x = Sepal.Length, y = Petal.Length))
+geom_smooth()
+geom_point ()
...
3.1 完整绘图模板
3.2 ggpubr 图片保存
3.3 eoffice
3.4 patchwork
3.5 常见问题
dev.off