Код: Выделить всё
class DataPlot:
#stuff
def update(self, plot_func):
self.ax.cla()
self.ax.grid()
plot_func()
self.ax.set_title(self.title)
self.ax.set_xlabel(self.x_label)
self.ax.set_ylabel(self.y_label)
plt.legend(loc="lower right", fontsize="5", ncol=2)
self.figure_agg.draw()
class View:
#stuff
def update_demo_plots(
self, calibration_sweeps: List[SensorSweep], test_sweeps: List[SensorSweep]
):
def demo_well1_update(calibration_sweeps, test_sweeps):
for c_num in range(8):
cal_x = [sweep.applied_voltages[c_num] for sweep in calibration_sweeps]
cal_y = [sweep.calculated_resistances[c_num] for sweep in calibration_sweeps]
self.well1_plot.ax.plot(
cal_x,
cal_y,
"s",
color="blue",
markersize=2,
label="Calibration" if c_num == 0 else None,
)
self.well1_plot.update(
lambda: demo_well1_update(calibration_sweeps, test_sweeps)
)
#other plotting
Я определил, что простого вызова self.figure_agg.draw() со всем остальным, закомментированного, достаточно, чтобы значительно замедлить работу графического интерфейса. . Как я могу улучшить и обойти это?
Подробнее здесь: https://stackoverflow.com/questions/790 ... matplotlib