posit-dev / posit-dev/hephaestus

From ggsql: Bad plot background dimensions

Open
#47 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
20
Forks
1
Avg merge
9h 18m
Merged PRs (30d)
4

Description

A polar plot reports desired_panel_aspect, which build_composition_grid turns into patch.aspect(1, 1) (src/plot/composition.rs:360-373). That aspect-locks the patch. Measured across canvas sizes:

canvas W | patch background x-range | legend text ends -- | -- | -- 960 | 0 … 960 | 905.9 1152 | 0 … 1152 | 1097.9 1344 | 78.6 … 1265.4 | 1289.9 1536 | 174.6 … 1361.4 | 1481.9 1920 | 366.6 … 1553.4 | 1865.9

The background keeps a constant width (1186.75) and is centred; the panel moves with it (+96 for a +192 canvas). The legend, though, is pinned to the full canvas — it always ends at canvas_width − 54.12, shifting by the full +192. So once the canvas is wide enough for the aspect lock to bite, the legend walks out of the patch it belongs to. Cartesian SETTING ratio => 1 takes the AspectMode::Range path instead and keeps a full-canvas background, which is why only polar (and presumably maps) show it.

The opaque canvas hides the symptom completely, since the legend is still drawn correctly — but the underlying layout inconsistency is still there and would show up again anywhere the patch background is not the canvas colour.

A polar plot reports desired_panel_aspect, which [build_composition_grid](https://github.com/posit-dev/hephaestus) turns into patch.aspect(1, 1) (src/plot/composition.rs:360-373). That aspect-locks the patch. Measured across canvas sizes:

canvas W patch background x-range legend text ends
960 0 … 960 905.9
1152 0 … 1152 1097.9
1344 78.6 … 1265.4 1289.9
1536 174.6 … 1361.4 1481.9
1920 366.6 … 1553.4 1865.9
The background keeps a constant width (1186.75) and is centred; the panel moves with it (+96 for a +192 canvas). The legend, though, is pinned to the full canvas — it always ends at canvas_width − 54.12, shifting by the full +192. So once the canvas is wide enough for the aspect lock to bite, the legend walks out of the patch it belongs to. Cartesian SETTING ratio => 1 takes the AspectMode::Range path instead and keeps a full-canvas background, which is why only polar (and presumably maps) show it.

The opaque canvas hides the symptom completely, since the legend is still drawn correctly — but the underlying layout inconsistency is still there and would show up again anywhere the patch background is not the canvas colour.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/plot/composition.rs:360-373 and trace how desired_panel_aspect becomes patch.aspect(1, 1) in build_composition_grid. Compare the polar layout with the Cartesian AspectMode::Range path across the canvas widths listed in the issue. Done means the patch background and legend remain aligned at wide canvas sizes without regressing the Cartesian behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.