vega-lite icon indicating copy to clipboard operation
vega-lite copied to clipboard

Support option for getting arrows at the end of rules

Open davidanthoff opened this issue 7 years ago • 8 comments

Then one could use rule marks to create nice quiver plots. I think it would really be two styling options: one for the beginning, and one for the end of the rule, and then a selection of arrows or other symbols.

davidanthoff avatar Nov 20 '18 20:11 davidanthoff

Yeah, that would be nice. I can imagine that we support symbols at the beginning and end of rule marks. I can imagine that this is a property of the rule mark.

We don't have the bandwidth to add this right now but would be happy to guide someone.

domoritz avatar Nov 20 '18 21:11 domoritz

Just FYI, this came up here. In that case one can actually achieve what the original question hoped to do with the shipping version, but I can also see that people will want proper quiver plots. No rush :) Wrap faceting is what I really have my fingers crossed for ;)

davidanthoff avatar Nov 20 '18 22:11 davidanthoff

Note that this will require support for angle for symbols in Vega for non-vertical/horizontal rules. On Tue, Nov 20, 2018 at 10:00 PM David Anthoff [email protected] wrote:

Just FYI, this came up here https://github.com/fredo-dedup/VegaLite.jl/issues/130. In that case one can actually achieve what the original question hoped to do with the shipping version, but I can also see that people will want proper quiver plots. No rush :) Wrap faceting is what I really have my fingers crossed for ;)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vega/vega-lite/issues/4270#issuecomment-440444643, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGypZMWR0SlO2XtclUepnOY1dv5tTGRks5uxHtqgaJpZM4Yr4XZ .

kanitw avatar Nov 20 '18 22:11 kanitw

The simplest way is probably to just add support for symbol angles and then you could use layer to add the arrow ends. Angle would be a new channel that only works with point marks (and only make sense for symbols).

Wrap faceting is what I really have my fingers crossed for ;)

Me too!

domoritz avatar Nov 20 '18 22:11 domoritz

I can see the two layer approach working, but on the other hand, it would be much easier for users if this was just a property of rules. Also, I'm just wondering whether something that is stitched together might have some visual "breaks". Things like, does the rule end exactly within the arrow, or is there some overlap/space might be quite tricky if it is just a layered story. Also, would be nice if things like line width would flow to the arrow as well...

davidanthoff avatar Nov 20 '18 23:11 davidanthoff

I completely agree but we could support both or treat the arrows in rule marks as a macro.

domoritz avatar Nov 20 '18 23:11 domoritz

I would love to see "angle' get added for symbols too, I can get so close to what I need with a triangle mark in a second layer, just need to be able to rotate it...

image

lovettchris avatar Apr 14 '19 05:04 lovettchris

For the reference, an arrow annotation example has been merged in Altair doc by https://github.com/altair-viz/altair/pull/3236: see Examples/Line Chart with Arrows.

However, about the previous comments about the possibility of using mark angles (which have been implemented in the mean time, see e.g. Wind Vector Map example), there is a catch. Indeed, as pointed out by @ChiaLingWeng (https://github.com/altair-viz/altair/pull/3236#issuecomment-1782355793), the arrow angles in a vector plot depend on the aspect ratio of that plot. I guess this is difficult to implement with the mark angles.

So in the end, having the option to add arrow heads at one or both ends of rule marks would still be a useful contribution.

pierre-haessig avatar Jan 19 '24 20:01 pierre-haessig