Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linesegments with arrow, or arrows method that takes a pair of points #2612

Open
ParadaCarleton opened this issue Jan 18, 2023 · 3 comments
Open
Labels
arrows Regarding the arrows plot type conversions Mainly `convert_arguments` enhancement Feature requests and enhancements Makie Backend independent issues (Makie core)

Comments

@ParadaCarleton
Copy link

Sometimes I just want to draw an arrow going from point A to point B; in that case, linesegments doesn't work (since it's a line, not an arrow), and arrows doesn't work (it's really meant to plot vector fields, rather than a single vector).

This could be fixed either by adding an extra argument to linesegments or to arrows.

@BambOoxX
Copy link

This is achievable by providing arrows with the right origin point and the right arrow component lengths
Somehting like

origin_points = rand(Point3,10)
target_points = rand(Point3,10)
arrow_components = (target_points .- origin_points) 
f = Figure()
l = LScene(f[1,1])
scatter!(l,origin_points,color=:red)
scatter!(l,target_points,color=:green)
arrows!(l,origin_points,arrow_components,color = RGBAf(0,0,255,0.5))

image

Pay attention to the arrowsize correction since an arrow head currently does not "point" at the target not, just its body see #2607 or #1206, #2472

@ffreyer ffreyer added enhancement Feature requests and enhancements Makie Backend independent issues (Makie core) arrows Regarding the arrows plot type conversions Mainly `convert_arguments` labels Aug 24, 2024
@aplavin
Copy link
Contributor

aplavin commented Aug 29, 2024

Available in MakieExtra with a selection of arrowstyles:
image
As always, feel free to upstream if there's such a desire.

@briochemc
Copy link
Contributor

What's nice about @aplavin's MakieExtra.jl solution is that the pointy arrow precisely points to the end point (instead of a overshooting by the arrow head size).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrows Regarding the arrows plot type conversions Mainly `convert_arguments` enhancement Feature requests and enhancements Makie Backend independent issues (Makie core)
Projects
Status: No status
Development

No branches or pull requests

5 participants