From f220783aca9340ab1d8dedeec2721837de782463 Mon Sep 17 00:00:00 2001
From: Djalim Simaila <DjalimS.pro@outlook.fr>
Date: Fri, 21 Apr 2023 17:54:22 +0200
Subject: [PATCH] added visplot and matplotlib cross section

---
 utils/graph2D/{plots.py => mpl_render.py} | 10 ++++++++++
 utils/graph2D/visplot_render.py           | 22 ++++++++++++++++++++++
 2 files changed, 32 insertions(+)
 rename utils/graph2D/{plots.py => mpl_render.py} (52%)
 create mode 100644 utils/graph2D/visplot_render.py

diff --git a/utils/graph2D/plots.py b/utils/graph2D/mpl_render.py
similarity index 52%
rename from utils/graph2D/plots.py
rename to utils/graph2D/mpl_render.py
index be38083..dd6450f 100644
--- a/utils/graph2D/plots.py
+++ b/utils/graph2D/mpl_render.py
@@ -8,4 +8,14 @@ def render2D(values:list):
     fig = plt.figure()
     ax = fig.add_subplot()
     ax.plot(values)
+    plt.show()
+
+def cross_section(x:list,y:list):
+    """
+    Render a 2D model using matplotlib
+    :param values: A list with the values
+    """
+    fig = plt.figure()
+    ax = fig.add_subplot()
+    ax.scatter(x,y)
     plt.show()
\ No newline at end of file
diff --git a/utils/graph2D/visplot_render.py b/utils/graph2D/visplot_render.py
new file mode 100644
index 0000000..86627b1
--- /dev/null
+++ b/utils/graph2D/visplot_render.py
@@ -0,0 +1,22 @@
+import vispy.plot as vp
+import numpy as np
+
+
+
+def render2D(values:list):
+    fig = vp.Fig(size=(600, 500), show=False)
+    plotwidget = fig[0, 0]
+    fig.title = "bollu"
+    plotwidget.plot(values)
+    plotwidget.colorbar(position="top", cmap="autumn")
+    fig.show(run=True)
+
+
+def cross_section(x:list,y:list):
+    color = (0.3, 0.5, 0.8)
+    fig = vp.Fig(show=False)
+    line = fig[0:4, 0:4].plot(np.column_stack((x,y)), symbol='o', width=0,
+                            face_color=color + (0.02,), edge_color=None,
+                            marker_size=8)
+    line.set_gl_state(depth_test=False)
+    fig.show(run=True)
\ No newline at end of file
-- 
GitLab