Skip to content

Instantly share code, notes, and snippets.

@WetHat
Last active March 14, 2024 10:10
Show Gist options
  • Star 59 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • 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.
@letrinhmath
Copy link

thanks

@yunacu
Copy link

yunacu commented Sep 21, 2021

Good job! thank you!

@Shen-ZH
Copy link

Shen-ZH commented Mar 31, 2022

I was thinking about how to solve such a 3D arrow annotation and found that you have created and perfected this feature, many thanks, sincere thanks from the other side of the internet!

@geusr
Copy link

geusr commented Sep 13, 2022

Works for me. Thank you!

@nicolasj92
Copy link

thanks

@andersonneira
Copy link

Awesome, thank you!

@dennisfgardner
Copy link

Just what I needed. Thank you!!

@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