小编Lin*_*ton的帖子

ggplot2 具有几何平均值的箱线图,以及第 90 和第 10 个百分位数

我需要创建一个独特的箱线图。我希望它代表几何平均值而不是中位数,并且框的顶部和底部是第 90 个和第 10 个百分位数。我找到了有关如何添加均值和 sd 以及如何在绘图上扩展 wiskers 但没有找到如何更改基本统计数据的信息。我想使用 ggplot2,因为我对它很熟悉,但我对任何事情都持开放态度。

我正在使用以下代码按年份绘制粪便大肠菌群数据:

library(psych)
library(dplyr)
library(zoo)
library(caTools)
library(ggplot2)
library(stats)

setwd("H:/MWQSampleData/GrowingAreaRawData")

setAs("character", "myDate", function(from) as.Date(from, format = "%m/%d/%Y"))

RawData <- read.csv("VaughnBay1989.csv", header = TRUE, colClasses = 
            c("factor", "factor", "myDate", "numeric", "factor", "numeric", "numeric","numeric"))

GrowingAreaYrSummary <- RawData %>%
  select(Year, FecalColiform) %>%
  group_by(Year)



Graph <- ggplot(GrowingAreaYrSummary, aes(x=Year, y=FecalColiform))
  geom_boxplot(outlier.shape = NA) +
  theme(axis.text.y = element_text(face = "bold", angle = 45, size = 14), 
        axis.text.x = element_text(face = "bold", angle = 45, size = 14, vjust …
Run Code Online (Sandbox Code Playgroud)

r ggplot2 boxplot

1
推荐指数
1
解决办法
4719
查看次数

标签 统计

boxplot ×1

ggplot2 ×1

r ×1