Skip to content

Instantly share code, notes, and snippets.

@WetHat
Last active February 24, 2026 00:37
Show Gist options
  • Select an option

  • Save WetHat/1d6cd0f7309535311a539b42cccca89c to your computer and use it in GitHub Desktop.

Select an option

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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@letrinhmath

Copy link
Copy Markdown

thanks

@yunacu

yunacu commented Sep 21, 2021

Copy link
Copy Markdown

Good job! thank you!

@Shen-ZH

Shen-ZH commented Mar 31, 2022

Copy link
Copy Markdown

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

geusr commented Sep 13, 2022

Copy link
Copy Markdown

Works for me. Thank you!

@nicolasj92

Copy link
Copy Markdown

thanks

@andersonneira

Copy link
Copy Markdown

Awesome, thank you!

@dennisfgardner

Copy link
Copy Markdown

Just what I needed. Thank you!!

@ksnxr

ksnxr commented May 31, 2023

Copy link
Copy Markdown

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

@luobroad

luobroad commented Jul 7, 2023

Copy link
Copy Markdown

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

luobroad commented Jul 7, 2023

Copy link
Copy Markdown

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

@anuarmenco

Copy link
Copy Markdown

tested on November 12, 2023 and works

@ShiboTan

Copy link
Copy Markdown

Thanks!

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