From f0529ea99b2da10c52400c868599ba1d498c288b Mon Sep 17 00:00:00 2001 From: Marina Usova Date: Mon, 27 Nov 2023 11:51:48 +0300 Subject: [PATCH] add lines layers by points --- .../SVC/_2D/Example_SVC_2D_Transformators_State.py | 7 +++++-- iOpt/output_system/painters/plotters/plotters.py | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/Machine_learning/SVC/_2D/Example_SVC_2D_Transformators_State.py b/examples/Machine_learning/SVC/_2D/Example_SVC_2D_Transformators_State.py index 89df03d..1d0167d 100644 --- a/examples/Machine_learning/SVC/_2D/Example_SVC_2D_Transformators_State.py +++ b/examples/Machine_learning/SVC/_2D/Example_SVC_2D_Transformators_State.py @@ -33,9 +33,12 @@ def factory_dataset(): method_params = SolverParameters(r=np.double(2.0), iters_limit=2000, number_of_parallel_points=5, evolvent_density=12) solver = Solver(problem=problem, parameters=method_params) - spl = StaticPainterNDListener("svc2d_transformator_state_stat.png", "output", vars_indxs=[0, 1], mode="surface", + spl1 = StaticPainterNDListener("svc2d_transformator_state_stat1.png", "output", vars_indxs=[0, 1], mode="surface", calc="by points") - solver.add_listener(spl) + solver.add_listener(spl1) + spl2 = StaticPainterNDListener("svc2d_transformator_state_stat2.png", "output", vars_indxs=[0, 1], mode="lines layers", + calc="by points") + solver.add_listener(spl2) log = "SVC_2D_Transformators_2000" solver.load_progress(log) # загружаем точки из файла в солвер solver.release_all_listener() # запускаем подключенных слушаетей diff --git a/iOpt/output_system/painters/plotters/plotters.py b/iOpt/output_system/painters/plotters/plotters.py index 14f7b34..11cfb08 100644 --- a/iOpt/output_system/painters/plotters/plotters.py +++ b/iOpt/output_system/painters/plotters/plotters.py @@ -357,6 +357,8 @@ def plot_interpolation(self, points, values, points_count=100): def plot_by_points(self, points, values): if self.plotterType == 'surface': self.ax.plot_trisurf(np.array(points)[:, 0], np.array(points)[:, 1], values, cmap=plt.cm.viridis, alpha=0.95) + if self.plotterType == 'lines layers': + self.ax.tricontourf(np.array(points)[:, 0], np.array(points)[:, 1], values, cmap=plt.cm.viridis) def plot_points(self, points, values, clr='blue', mrkr='o', mrkrs=3): if self.plotterType == 'lines layers': self.ax.scatter(np.array(points)[:, 0], np.array(points)[:, 1], color=clr, marker=mrkr, s=mrkrs)