ITADN

Slightly inconsistent y-axis title gap (depending on tick label widths)

#596Opengrantmcdermott 创建于 2026-05-29
G
grantmcdermottcommented
Something I spotted while working on #595. The issue is subtle and only really occurs when switching between single character y labels and 2+ character labels. Note the _slightly_ bigger gap between the y title and labels in the top plot compared to the bottom plot. ``` r library(tinyplot) # current dev version tinytheme('bw', grid = FALSE) plt(1, yaxb = 1, xaxb = 1, xlab = "Xx", ylab = "Yy", type = "n") ``` ![](https://i.imgur.com/6WLT10i.png)<!-- --> ``` r plt(10, yaxb = 10, xaxb = 1, xlab = "Xx", ylab = "Yy", type = "n") ``` ![](https://i.imgur.com/WH7J1XP.png)<!-- --> ``` r tinytheme() ``` <sup>Created on 2026-05-29 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup> Again, it's subtle but the gap should be constant (exactly equal to `gap.lab`) regardless of label width. The good news is that Claude and I have identified the culprit, which actually stems from three issues: 1. The `whtsbp` threshold used a cex-dependent value (`min(1, 0.5 * cex_axis)`) that created a discontinuity at the narrow/wide label boundary 2. The bump was clamped to `≥ 0`, so narrow-label plots never adjusted their margin or title position 3. A negative `ymgp_shift` (from `cex_axis < 1`) pushed the title away from labels Fix incoming as part of #595.
0 条评论