davidhodge931 / ggblanket

Simplify ggplot2 visualisation
https://davidhodge931.github.io/ggblanket/
Other
150 stars 8 forks source link

For `stat = "bin"` etc where `x_transform` not equal to identity, zoom is incorrect #969

Open davidhodge931 opened 3 weeks ago

davidhodge931 commented 3 weeks ago

The plot is correct, but the zoom is incorrect.

Users can adjust coord and y_breaks to fix.

Might be impossible to fix...

library(tidyverse)
library(ggblanket)

set_blanket()

ggplot(msleep, aes(x = brainwt)) +
  geom_histogram(na.rm = TRUE) +
  scale_x_log10()

msleep |>
  gg_histogram(
    x = brainwt, 
    x_transform = "log10",
  )

msleep |>
  gg_histogram(
    x = brainwt, 
    x_transform = "log10",
    y_breaks = scales::breaks_width(width = 2),
    coord = coord_cartesian(ylim = c(0, 6))
  )
davidhodge931 commented 3 weeks ago

Could add an inform message...