-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPlotting.py
31 lines (26 loc) · 857 Bytes
/
Plotting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
class Plotting:
def __init__(self, name, xlim=[-6,6], ylim=[-6,6], zlim=[0,5], is_grid=True):
self.fig = plt.figure()
self.ax = plt.axes(projection ='3d')
self.ax.set_title(name)
self.ax.grid(is_grid)
self.ax.set_xlim(xlim)
self.ax.set_ylim(ylim)
self.ax.set_zlim(zlim)
self.ax.set_xlabel('x [m]')
self.ax.set_ylabel('y [m]')
self.ax.set_zlabel('z [m]')
def plot_path(self, path):
path = np.array(path)
self.ax.plot(path[:,0], path[:,1], -path[:,2])
# def plot_ref(self, ref):
# if __name__ == "__main__":
# path = [[1,2,3,4],
# [1,0,1,0],
# [2,3,4,1]]
# plot = Plotting("Haha")
# plot.plot_path(path)
# plt.show()