Closed davidhodge931 closed 1 month ago
library(tidyverse)
library(palmerpenguins)
library(ggblanket)
############################
#if stat is identity...
############################
penguins |>
filter(between(bill_depth_mm, 0, 15)) |>
gg_point(
x = bill_depth_mm,
y = body_mass_g,
x_expand_limits = 13,
x_expand = c(0, 0),
)
############################
#otherwise if stat is not identity...
############################
#To zoom in, use coord and *_breaks
penguins |>
gg_smooth(
x = body_mass_g,
y = bill_depth_mm,
se = TRUE,
coord = coord_cartesian(ylim = c(NA, 15)),
y_breaks = scales::breaks_width(0.05), #need to recreate breaks on symmetric axis
# y_symmetric = FALSE,
)
#To zoom out, use *_expand_limits
penguins |>
gg_smooth(
x = body_mass_g,
y = bill_depth_mm,
se = TRUE,
x_expand_limits = c(0),
# y_expand_limits = c(10, 25),
)
Make an edge case work
library(tidyverse)
library(palmerpenguins)
library(ggblanket)
set_blanket()
diamonds |>
gg_bin_2d(
x = carat,
y = price,
y_symmetric = FALSE, #make the limits the min/max
y_expand_limits = 20000,
y_expand = c(0, 0),
)
Created on 2024-06-23 with reprex v2.1.0
If *_symmetric = TRUE, then:
*_expand_limits
)*_expand
defaults to c(0, 0)If *_symmetric = FALSE, then:
*_expand_limits
)*_expand
defaults to c(0.05, 0.05)Remove
*_limits
*_transform
*_oob
Instead, users can get what they want using a combo of:
*_expand_limits
,*_expand
,*_symmetric
,*_breaks
,coord_cartesian(xlim = ..., ylim = ...)
+ scale_*_*(limits = ...)
Make expand limits work the same way as ggplot2
x, y, col