如何使用R ggplot stat_summary绘制中位数和四分位数? [英] How to use R ggplot stat_summary to plot median and quartiles?
本文介绍了如何使用R ggplot stat_summary绘制中位数和四分位数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将此统计摘要图中的上下限更改为25%四分位数和75%四分位数?
how to change the lower and upper point in this stat summary plot to 25% quartile and 75% quartile?
ggplot(data = diamonds) + stat_summary(
mapping = aes(x = cut, y = depth),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
推荐答案
ggplot(data = diamonds) + stat_summary(
mapping = aes(x = cut, y = depth),
fun.min = function(z) { quantile(z,0.25) },
fun.max = function(z) { quantile(z,0.75) },
fun = median)
这篇关于如何使用R ggplot stat_summary绘制中位数和四分位数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文