rggplot2ggthemes

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)


Solution

  • 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)