-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add arrow curvature to sources and monitors with bend radius (#272) #714
Conversation
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 just tested this out on the Modes_bent_angled
and a couple other notebooks and it looks fantastic, thanks.
I think the solution you described with the arrow head size makes sense, even for straight arrows.
Only things are:
- maybe the arrows could be a little bit longer? to truly show some of the curvature? what do you think?
- there are some pylint errors
Thanks a lot!
Can you also throw a line in the changelog as well? Thanks |
I tried to keep them only large enough to be easily visible, but not taking too much space (they are not usually the user focus), but I can definitely increase the default a bit.
I'll look into those as soon as I can. I have something urgent to take care of, but I'll get to it soon |
d004c95
to
2a392b1
Compare
Looks good to me! what is the last plot? is it supposed to curve out of plane like that? This is awesome, thanks @lucas-flexcompute ! |
That's just a test for a long and thin simulation bound, and they are curved around the different axis for testing as well. |
Hi Lucas, unfortunately we didn't notice this earlier, but this PR is meant to go into |
2a392b1
to
0cf250a
Compare
@momchil-flex No problem, there were only small conflicts. |
Awesome, thanks! |
Curved arrows are only possible through FancyArrowPatch, but those define the arrow head size in display coordinates and end points in data coordinates. Furthermore, the arrow head is included in the total length, as opposed to what happens with Axes.arrow, that was used before. The result is that the arrow length calculated based on the axes limits or simulation boundaries can end up too small for the arrow head (and for visualization as well). The solution here, which might actually be preferable even without the bending, is to define the arrow size in real units (inches, following matplotlib's DPI setting) so that the arrows are always the same size. That can only be accomplished by waiting for the transformations to be set, at drawing time, so we use a `draw_event` callback to calculate the arrow shape. If the drawing window is resized, the arrow length will change, though, because the callback is only called once (to avoid the danger of inifite loops). Signed-off-by: Lucas Heitzmann Gabrielli <[email protected]>
0cf250a
to
c62f5a6
Compare
I removed two commits that had been picked up from the develop branch. |
Curved arrows are only possible through FancyArrowPatch, but those define the arrow head size in display coordinates and end points in data coordinates. Furthermore, the arrow head is included in the total length, as opposed to what happens with Axes.arrow, that was used before. The result is that the arrow length calculated based on the axes limits or simulation boundaries can end up too small for the arrow head (and for visualization as well).
The solution here, which might actually be preferable even without the bending, is to define the arrow size in real units (inches, following matplotlib's DPI setting) so that the arrows are always the same size. That can only be accomplished by waiting for the transformations to be set, at drawing time, so we use a
draw_event
callback to calculate the arrow shape.If the drawing window is resized, the arrow length will change, though, because the callback is only called once (to avoid the danger of inifite loops).