1234567891011121314151617181920212223242526272829303132 |
- import matplotlib
- from matplotlib.figure import Figure
- from matplotlib import style
- import numpy as np
- from .globals import *
- style.use("ggplot")
-
- class Plot():
- def __init__(self, points, plots = 1):
- self.fig = Figure()
- self.ax = self.fig.add_subplot(111)
- self.xs = range(points)
- self.ys = np.ndarray(shape=(plots, points), dtype=float)
- self.i = 0
- self.points = points
- self.plots = plots
- def setTitle(self, title):
- self.ax.set_title('Windkanal')
- def update(self, values):
- self.ax.clear()
- for p in range(self.plots):
- self.ys[p][self.i] = values[p]
- self.ax.plot(self.xs, self.ys[p], "#00A3E0", label=f"{p+1}. Graph")
-
- self.i = (self.i+1) % self.points
- self.ax.legend(bbox_to_anchor=(0, 1.02, 1, .102), loc=3, ncol=2, borderaxespad=0)
-
|