Skip to content

issue570#580

Merged
grantmcdermott merged 2 commits intomainfrom
facet_free_dynmar
May 8, 2026
Merged

issue570#580
grantmcdermott merged 2 commits intomainfrom
facet_free_dynmar

Conversation

@grantmcdermott
Copy link
Copy Markdown
Owner

Fixes #570

pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot

# Decimal precision difference 
dat = data.frame(
  x_variable = rep(c(0, 10), times = 4),
  y_variable = c(0.707, 0.708, 0.711, 0.704, 0.293, 0.292, 0.289, 0.297),
  f_variable = rep(c("A", "B"), each = 4)
)

plt(
  y_variable ~ x_variable, 
  facet = ~ f_variable, facet.args = list(free = TRUE),
  data = dat,
  theme = 'clean'
)

One minor bummer is that the vastly different scales can lead to "unecessary" spacing adjustment for the smaller subsets (e.g., LHS facet below). But I think it's better to be consistent in facet sizing, not to mention much simpler to use a single par("mar") adjustment.

# Scale difference between facets                                                                         
dat = data.frame(
  x_variable = rep(0:10, times = 2),
  y_variable = c(0:10, 1000000:1000010),
  f_variable = rep(c("A", "B"), each = 11)
)

plt(
  y_variable ~ x_variable, 
  facet = ~ f_variable, facet.args = list(free = TRUE),
  data = dat,
  theme = 'clean'
)

Created on 2026-05-08 with reprex v2.1.1

@grantmcdermott grantmcdermott merged commit 768ad72 into main May 8, 2026
3 checks passed
@grantmcdermott grantmcdermott deleted the facet_free_dynmar branch May 8, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Free facets + dynamic themes: Bad margin spacing for y-axis labels of different scales

1 participant