mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-21 13:20:37 +08:00
20 lines
683 B
Python
20 lines
683 B
Python
# Matplotlib
|
|
# Check also Visdom: https://github.com/facebookresearch/visdom
|
|
|
|
import matplotlib.pyplot as plt
|
|
from mpl_toolkits.mplot3d import Axes3D
|
|
from matplotlib.patches import FancyArrowPatch
|
|
|
|
|
|
class Arrow3D(FancyArrowPatch):
|
|
r"""This class allows to draw a 3D arrow"""
|
|
|
|
def __init__(self, xs, ys, zs, *args, **kwargs):
|
|
FancyArrowPatch.__init__(self, (0,0), (0,0), *args, **kwargs)
|
|
self._verts3d = xs, ys, zs
|
|
|
|
def draw(self, renderer):
|
|
xs3d, ys3d, zs3d = self._verts3d
|
|
xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
|
|
self.set_positions((xs[0],ys[0]),(xs[1],ys[1]))
|
|
FancyArrowPatch.draw(self, renderer) |