Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Boxplot looks different from facet_grid #26

@mattocci27

Description

@mattocci27

Hi, I'm not sure why these two boxplots look different. In facet_grid_sc, y1
has shorter lines and doesn't have outliers.

set.seed(123)
y1 <- rlnorm(200, 1, 4)
y2 <- rlnorm(200, 3, 5)

dat <- tibble(y1, y2) %>%
  pivot_longer(1:2) %>%
  mutate(gr = rep(c("gr1", "gr2"), each = 200))

ggplot(dat, aes(x = name, y = value)) +
  geom_boxplot() +
  facet_grid(gr ~ .) +
  scale_y_log10()

unnamed-chunk-1-1

scales_y <- list(
 gr1 = scale_y_log10(),
 gr2 = scale_y_log10())

ggplot(dat, aes(x = name, y = value)) +
  geom_boxplot() +
  facetscales::facet_grid_sc(rows = vars(gr),
                             scales = list(y = scales_y))

unnamed-chunk-2-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions