Skip to content

Instantly share code, notes, and snippets.

@WetHat
Last active March 14, 2024 10:10
Show Gist options
  • Save WetHat/1d6cd0f7309535311a539b42cccca89c to your computer and use it in GitHub Desktop.
Save WetHat/1d6cd0f7309535311a539b42cccca89c to your computer and use it in GitHub Desktop.
Matplotlib: 3D Arrows and 3D Annotations
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ksnxr
Copy link

ksnxr commented May 31, 2023

Thanks for the gist! Is there a license for it?

@luobroad
Copy link

luobroad commented Jul 7, 2023

One suggestion for this code is add return arrow to the end of def _arrow3D to read:

def _arrow3D(ax, x, y, z, dx, dy, dz, *args, **kwargs):
    '''Add an 3d arrow to an `Axes3D` instance.'''

    arrow = Arrow3D(x, y, z, dx, dy, dz, *args, **kwargs)
    ax.add_artist(arrow)
    return arrow

This will make other artist3d functions work, such as set_visible

@luobroad
Copy link

luobroad commented Jul 7, 2023

P.S. Would you like to PR to matplotlib? This would be helpful...

@anuarmenco
Copy link

tested on November 12, 2023 and works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment