Skip to content

Should the RHS margin of themed plots adjust to accomodate x-axis tick labels? #492

Closed

Description

@grantmcdermott

We currently have the undesirable property that long(ish) labels can get cut off.

For example:

library(tinyplot)

mod = lm(body_mass ~ 0 + species, data = penguins)
coefs = data.frame(
  names(coef(mod)),
  coef(mod),
  confint(mod)
) |> setNames(c("term", "estimate", "lwr", "upr"))

plt(
  estimate ~ term,
  ymin = lwr, ymax = upr,
  data = coefs,
  type = "errorbar",
  theme = "clean"
)
box("outer", lty = 2)

Created on 2025-09-21 with reprex v2.1.1

Somewhat related to #479

Activity

  1. grantmcdermott commented on Sep 15, 2026

    @grantmcdermott
    OwnerAuthor

    This issue is much less of a problem now, following the introduction of rotated labels (x/yaxr #717) and the improved spacing for axes with few categorical levels (#732). E.g., the exact same plot above now clears the clipping threshold without a problem:

    Of course, that's not say that this will never be an issue. But I think dynamic spacing adjustment for labels is the wrong way to go and will require a lot of code for something that users can easily avoid with rotated labels, flipped plots, multline axis labels (via x/yaxl), etc. I'll add some examples to the docs that demonstrate these ideas and then close this issue.

  2. grantmcdermott commented on Sep 20, 2026

    @grantmcdermott
    OwnerAuthor

    Closed with #736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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