简体   繁体   中英

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? I tried changing the outlier and whisker arguments to no avail.

library(ggplot2)
library(ggthemes)

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

Whisker extend to 1.5xIQR as usual:

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)

I was able to find a workable solution by changing the stat to "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):

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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