-
Notifications
You must be signed in to change notification settings - Fork 0
/
surface_chart.py
26 lines (22 loc) · 937 Bytes
/
surface_chart.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
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from mpl_toolkits.mplot3d import Axes3D
class SurfaceChart(FigureCanvas):
def __init__(self):
self.fig =plt.figure(figsize=(7,7))
FigureCanvas.__init__(self, self.fig)
self.axes = self.fig.gca(projection='3d')
self.setWindowTitle("Main")
def draw_graph(self, x, y, z):
self.axes.clear()
self.axes.plot_surface(x, y, z, cmap=cm.coolwarm, alpha=0.75,
linewidth=0, antialiased=True)
self.draw()
self.axes.set_xlabel("x")
self.axes.set_ylabel("y")
self.axes.set_zlabel("z")
def draw_simplex(self, args):
x1, y1, z1, x2, y2, z2, x3, y3, z3, color = args
self.axes.plot([x1, x2, x3, x1], [y1, y2, y3, y1], [z1, z2, z3, z1], color=color, linewidth=2)
self.draw()