Skip to content

Arrows at line ends - #597

Open
teunbrand wants to merge 20 commits into
posit-dev:mainfrom
teunbrand:arrows
Open

teunbrand wants to merge 20 commits into
posit-dev:mainfrom
teunbrand:arrows

Conversation

@teunbrand

Copy link
Copy Markdown
Collaborator

This PR aims to fix an entry in #530.

Briefly this allows SETTING arrow => 'open' in line, path and segment geometries.
By default, this sets the end arrow and when using length-2 array e.g. ['open', 'open'] it sets the start and end arrows.
We take hephaestus arrows, but omit the arrow- prefix.
Arrow size by default is hephaestus' default (3x linewidth), but size can also be set by using a numeric suffix, e.g. 'open:10'.

Comment on lines +173 to +175
/// Constant channels from layer parameters, scale-bypassing (e.g.
/// `start_marker`/`end_marker` from the `arrow` SETTING).
pub constants: Vec<(&'static str, HValue)>,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is already a pre-existing path parameters should take, we should use that instead.

Comment thread src/validate.rs Outdated
Comment on lines +278 to +286
// Same rationale as the aggregate check above: surface `arrow`
// vocabulary errors without executing.
if let Err(e) = crate::plot::layer::geom::types::validate_arrow_param(&layer.parameters)
{
errors.push(ValidationError {
message: format!("{}: {}", context, e),
location: None,
});
}

This comment was marked as resolved.

@thomasp85

Copy link
Copy Markdown
Collaborator

I'd actually argue that line-ends should be a proper aesthetic (line-start and line-end separately)

@teunbrand

Copy link
Copy Markdown
Collaborator Author

I'm not ideologically opposed to that, that is also what I did in ggarrow. But it needs some discussion around palettes, discrete vs continuous and how it interplays with sizing.

@thomasp85

Copy link
Copy Markdown
Collaborator

I'm honestly only interested in a shape like scale for the look of it - I'm fine for now with letting the size follow the linewidth

@teunbrand

Copy link
Copy Markdown
Collaborator Author

I've made them proper aesthetics now. Current behaviour is best captured in scale/aesthetic/arrow.qmd doc.

@teunbrand

Copy link
Copy Markdown
Collaborator Author

Current test failure repeats in main (signal: 11, SIGSEGV: invalid memory reference), so probably this PR isn't to blame.

@thomasp85

Copy link
Copy Markdown
Collaborator

I thought we agreed on arrow_start and arrow_end aesthetics? With the current setup I can't see how it's possible to scale start and end arrows, only end arrows

@thomasp85

Copy link
Copy Markdown
Collaborator

even better, we shouldn't use arrow as a name since any type of mark can be placed there... perhaps mark_start and mark_end?

@teunbrand

teunbrand commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

I thought we agreed on arrow_start and arrow_end aesthetics?

This is the case, but that you didn't stumble on this might mean some docs are stale and I should check these.

even better, we shouldn't use arrow as a name since any type of mark can be placed there... perhaps mark_start and mark_end?

Pros:

  • Better name for something that can take any shapes beyond arrow-heads and tails.

Cons:

  • Worse name for discoverability when folks want arrows, which I guestimate to be ~80% of use cases.
  • 'Mark' is already multivalent in datavis space, where e.g. vegalite will name their layers 'mark's.

Because these hook into the shape mechanism I'd be content for these to be called 'start_shape' and 'end_shape', but then we can't do the aliasing trick because 'shape' is already an aesthetic with a different default palette.

@thomasp85

Copy link
Copy Markdown
Collaborator

Ah, sorry... I came to the docs and saw something that didn't match and immediately stopped 🙈

I think start_shape and end_shape (or shape_start/shape_end) are better... That also feeds nicely into an eventual shape_vertex or something if we want to expose that

This branch has not been deployed

No deployments
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.

2 participants