简体   繁体   English

ggthemes::geom_tufteboxplot - 防止胡须延伸到极端

[英]ggthemes::geom_tufteboxplot - prevent whiskers from extending to extremes

Does someone know how to prevent the "whiskers" in ggthemes::geom_tufteboxplot to be drawn up to the extreme values?有人知道如何防止ggthemes::geom_tufteboxplot的“胡须”被绘制到极值? I tried changing the outlier and whisker arguments to no avail.我尝试更改outlierwhisker参数无济于事。

library(ggplot2)
library(ggthemes)

ggplot(iris, aes(Species, Sepal.Length)) +
  geom_boxplot() 

Whisker extend to 1.5xIQR as usual:晶须像往常一样扩展到 1.5xIQR:

ggplot(iris, aes(Species, Sepal.Length)) +
  geom_tufteboxplot()

"Whisker" extend to extreme value “晶须”延伸至极值

Created on 2020-03-03 by the reprex package (v0.3.0)reprex 包(v0.3.0) 于 2020 年 3 月 3 日创建

I was able to find a workable solution by changing the stat to "boxplot".通过将 stat 更改为“boxplot”,我能够找到可行的解决方案。 Here's a reprex (the last example shows how to hide outliers, although the axis range will still consider them; the work-around for that is more involved):这是一个 reprex(最后一个示例显示了如何隐藏异常值,尽管轴范围仍会考虑它们;解决方法更复杂):

library(ggplot2)
library(ggthemes)

ggplot(iris, aes(Species, Sepal.Length)) +
  geom_boxplot()

ggplot(iris, aes(Species, Sepal.Length)) +
  ggthemes::geom_tufteboxplot(stat = "boxplot")

ggplot(iris, aes(Species, Sepal.Length)) +
  ggthemes::geom_tufteboxplot(stat = "boxplot", outlier.shape = NA)

Created on 2020-05-29 by the reprex package (v0.3.0)reprex 包(v0.3.0) 于 2020 年 5 月 29 日创建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM