![](/img/trans.png)
[英]Error in stat_summary(fun.y) when plotting outliers in a modified ggplot-boxplot
[英]fun.y and stat_summary stopped working in ggplot
我曾經一直運行此代碼以在我的條形圖頂部獲得“n”的總和。
現在我收到以下錯誤:
忽略未知參數:fun.y
沒有提供摘要 function,默認為
mean_se()
count %>%
ggplot(aes(x = date, y = n, group = class, fill = class)) +
geom_col() +
geom_text_repel(
aes(label = stat(y), group = date),
stat = 'summary', fun.y = sum, vjust = -1
)
這是ggplot2
版本的 API 與ggplot2 3.3.0
的變化。 從文檔:
fun.ymin、fun.y、fun.ymax 已棄用,請改用上面指定的版本。
只需切換到fun
。
library(ggrepel)
library(ggplot2)
library(dplyr)
mtcars %>%
count(gear, cyl) %>%
ggplot(aes(x = factor(gear), y = n, group = factor(cyl), fill = factor(cyl))) +
geom_col() +
geom_text_repel(
aes(label = stat(y), group = factor(gear)),
stat = 'summary', fun = sum, vjust = -1
)
由reprex package (v0.3.0) 創建於 2020-04-14
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.