-
Notifications
You must be signed in to change notification settings - Fork 23
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
if arrow_shift = :end
, move arrows to surface of destination node
#108
Conversation
nodes = Circle; arrows = Arrow (Polygon)
update docstring
Changed the default node and arrow markers so that their size matches their pixels (ie., 1x1 base size; see https://docs.makie.org/v0.19/examples/plotting_functions/scatter/index.html#markersize) |
|
Codecov ReportBase: 80.45% // Head: 81.29% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #108 +/- ##
==========================================
+ Coverage 80.45% 81.29% +0.84%
==========================================
Files 4 4
Lines 573 647 +74
==========================================
+ Hits 461 526 +65
- Misses 112 121 +9
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
move_arrows_to_nodes!
and update docs
move_arrows_to_nodes!
and update docsarrow_shift = 1
, move arrows to surface of destination node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not totally sure about the choice arrow_shift=:end
vs arrow_shift=1
. I tend to prefere :end
because otherwise the arrow_shift
is not continous in 0..1
but instead at 1 the arrows jump back.
I changed it to :end and updated docstring |
arrow_shift = 1
, move arrows to surface of destination nodearrow_shift = :end
, move arrows to surface of destination node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I finally tried it locally and it works quite nice, thanks for the contribution! Three minor things i've noticed:
Recalculate on _size
change
g = SimpleDiGraph(3)
add_edge!(g, 1, 1); add_edge!(g, 1, 2); add_edge!(g, 2, 1); add_edge!(g, 2, 3); add_edge!(g, 3, 1);
# test update of node and arrow size
fig, ax, p = graphplot(g; arrow_shift=:end,
node_size=[20 for _ in 1:nv(g)],
arrow_size=[20 for _ in 1:ne(g)])
p.node_size[][1] = 40
notify(p.node_size) # does not update arrow shift
p.arrow_size[][3] = 40
notify(p.arrow_size) # does not update arrow shift
notify(p[:node_pos]) # updates arrow shift
I don't now the chain of observable trigger actions of the top of my head, but change in [arrow|node]_size
should probably trigger update of the arrow shift.
Error for 3d plos
using GraphMakie: Spring
fig, ax, p = graphplot(g; arrow_shift=:end, layout=Spring(dim=3))
Errors at reipes.jl:687
because of addition of 2d point to 3d point. I think this should fail early with an error message that 3d plots are not supportet with :end
currently.
interpolation fails when zooming out
If the markers get very big with respect to the node distances something goes wrong and throws an error. The easisest to reproduce is to scroll out in a plot very far. I'm not sure where that happens. I think this is due to the desired distance getting negative or so. This should be chacked somewhere. Maybe let reverse_interpolate
throw an ArgumentError
, catch that in update_arrowshift
and set it to 0.5?
Thanks for testing these.
|
This PR changes the behavior when
arrow_shift = :end
. Instead of having the center of the arrow marker on the center of the destination node, the code now calculates the position along the edge such that the tip of the arrow marker will touch the tip of the destination node marker. Note: currently works properly forCircle
node marker andArrow
arrow marker since these are of base size1x1
.radius_px
can be extended for other marker types that do not have a1x1
base size.close #107
close #101
close #109
close #112
and update docs
To do: