Skip to content

geom_boxplot outliersΒ #4892

@ggrothendieck

Description

@ggrothendieck

An easier way to remove outliers and expand the boxplots to fill the graph would be nice.

This does work but I would have thought that there would be some less manual way of doing it.

library(ggplot2)
xlim_ <- range(boxplot.stats(mpg$hwy)$stats)
ggplot(mpg, aes(hwy, class)) +
  geom_boxplot(outlier.shape = NA) +
  xlim(xlim_)
#> Warning: Removed 3 rows containing non-finite values (`stat_boxplot()`).

In classical graphics outline=FALSE will both omit outliers and cause boxes to fill the graph.

boxplot(hwy ~ class, mpg, outline = FALSE, horizontal = TRUE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions