ggplot2学习笔记(1)——绘图系统

ggplot2的语法系统将数据层和美化层分开。

ggplot2的几大系统函数

图的类型geom_X系列:

geom_bar()      #柱状图
geom_point      #散点图
geom_boxplot    #箱型图
geom_histogram  #直方图
...

标度调整系统:

轴标度【scales_x/y_continuous/discrete】、
颜色标度【scale_fill/colour_continuous/discrete/manual】、
透明度标度【scale_alpha_continuous/discrete/manual】、
大小标度【scale_size/radius_area】、
形状标度【scale_shape】、
线条类型标度【scale_linetype】

参考:标度调整另一个
坐标系系统:

coord_flip()    #坐标轴转换
coord_polar()
coord_map()

图例系统:

guides()                #总函数
    guide_colorbar()    #连续型变量
    guide_legend()      #离散型变量

分面系统:

facet_grid()
facet_wrap()

主题系统:(美化函数)

theme()
theme_get()
theme_set(new)
theme_update(...)
theme_replace(...)
e1 %+replace% e2

element_text()
element_rect()
element_line()
element_blank()

参考:主题参数

基本语法

ggplot() + geom_x + scale_X + ... + theme()
ggplot()提供基础画布,geom_x说明图的类型。

posted @ 2021-12-27 11:34  陈其永  阅读(114)  评论(0编辑  收藏  举报