2021-04-14

ggplot中几何对象和统计变换对应表

绘图时用来计算新数据的算法称为 stat(statistical transformation, 统计变换)。

统计变换可以生成新的变量并在图形中展示。通过查看 stat 参数的默认值,你可以知道几何对象函数使用了哪种统计变换。例
如, ?geom_bar 显示出 stat 的默认值是 count,这说明 geom_bar() 使用 stat_count() 函数进行统计变换。 stat_count() 在文档中与 geom_bar() 位于同一页,如果继续向下看,你可以发现名为“Computed variables”的一节,它告诉我们 stat_count() 会计算出两个新变量: count 和 prop,图1。表1列出了所有的几何对象和统计变换的对应关系。

                                                                   图1:stat_count()中的“Computed variables”

 


                                                                   表1:ggplot中几何对象和统计变换对应表

geomsstatsfunction
geom_bar(),geom_col()stat_count()Bar charts
geom_bin2d()stat_bin_2d()heatmap of 22d bin counts
geom_boxplot()stat_boxplot()A box and whiskers plot (in the style of Tukey)

geom_contour()

geom_contour_filled()

stat_contour()

stat_contour_filled()

2D contours of a 3D surface
geom_function()stat_function(0Draw a function as a continuous curve
geom_count()stat_sum()Count overlapping points
geom_density()stat_density()Smoothed density estimates

geom_density_2d()

geom_density_2d_filled()

stat_density_2d()

stat_density_2d_filled()

Contours of a 2D density estimate
geom_hex()stat_bin_hex()Hexagonal heatmap of 2d bin counts

geom_freqpoly()

geom_histogram()

stat_bin()Histograms and frequency polygons

geom_qq_line()

geom_qq()

stat_qq_line()

stat_qq()

A quantile-quantile plot
geom_quantile()stat_quantile()Quantile regression
geom_smooth()stat_smooth()Smoothed conditional means
geom_violin()stat_ydensity()Violin plot

coord_sf()

geom_sf()

geom_sf_label()

geom_sf_text()

stat_sf()Visualise sf objects
geom_pointrange()stat_summary()Various ways of representing a vertical interval defined by x, ymin and ymax. Each case draws a single graphical object.

 

参考:https://ggplot2.tidyverse.org/reference/

           R数据科学

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值