diff --git a/utils/graph2D/visplot_render.py b/utils/graph2D/visplot_render.py index 937c6fc8eff9f78922363d2abf9390dcdd5cb943..e4518600c920b39836117163f5cd440584521a49 100644 --- a/utils/graph2D/visplot_render.py +++ b/utils/graph2D/visplot_render.py @@ -1,7 +1,7 @@ import vispy.plot as vp import numpy as np -def render2D(values:list,title:str,show:bool=True): +def render2D(values:list,title:str,xlabel="",ylabel="",show:bool=True): """ Render a 2D plot using vispy :param values: A list with the values @@ -9,13 +9,18 @@ def render2D(values:list,title:str,show:bool=True): fig = vp.Fig(size=(600, 500), show=False) plotwidget = fig[0, 0] fig.title = title - plotwidget.plot(values,marker_size=0, width=2,title=title) + plotwidget.plot(values, + marker_size=0, + width=2, + title=title, + xlabel=xlabel, + ylabel=ylabel) if show: fig.show(run=True) else: return fig -def cross_section(x_values:list, y_values:list,title:str, show:bool=True ): +def cross_section(x_values:list, y_values:list,title:str,xlabel="",ylabel="",show:bool=True ): """ Render a 2D cross section using vispy :param x: A list with the x values @@ -23,9 +28,15 @@ def cross_section(x_values:list, y_values:list,title:str, show:bool=True ): """ color = (0.3, 0.5, 0.8,.8) fig = vp.Fig(show=False) - line = fig[0:4, 0:4].plot(np.column_stack((x_values,y_values)), symbol='disc', width=0, - face_color=color, edge_color=None, - marker_size=8,title=title) + line = fig[0:4, 0:4].plot(np.column_stack((x_values,y_values)), + symbol='disc', + width=0, + face_color=color, + edge_color=None, + marker_size=8, + title=title, + xlabel=xlabel, + ylabel=ylabel) line.set_gl_state(depth_test=False) if show: fig.show(run=True) diff --git a/utils/gui/pyqt/main_window/MainWindow.py b/utils/gui/pyqt/main_window/MainWindow.py index 71d8714142797aacbd755c41f7e41f85b3efd742..d32585de1cbeab74b12ae1faea8c22b1ee4072af 100644 --- a/utils/gui/pyqt/main_window/MainWindow.py +++ b/utils/gui/pyqt/main_window/MainWindow.py @@ -249,11 +249,25 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): if graph_type == "Mesh3D": current_slot.addWidget(render3D(obj,False).native) if graph_type == "Coupe XZ": - current_slot.addWidget(cross_section(obj.get_x(),obj.get_z(),"Coupe XZ",False).native) + current_slot.addWidget(cross_section(obj.get_x(), + obj.get_z(), + "Coupe XZ", + "X (en mm)", + "Z (en mm)", + False).native) if graph_type == "Coupe YZ": - current_slot.addWidget(cross_section(obj.get_y(),obj.get_z(),"Coupe YZ",False).native) + current_slot.addWidget(cross_section(obj.get_y(), + obj.get_z(), + "Coupe YZ", + "Y (en mm)", + "Z (en mm)", + False).native) if graph_type == "Evolution du rayon moyen": - current_slot.addWidget(render2D(list(zip(discrete_data['Z moy (en mm)'],discrete_data['Rayon moyen (en mm)'])),"Evolution du rayon moyen",False).native) + current_slot.addWidget(render2D(list(zip(discrete_data['Z moy (en mm)'],discrete_data['Rayon moyen (en mm)'])), + "Evolution du rayon moyen en fonction de Z", + "Z (en mm)", + "Rayon moyen (en mm)\n", + False).native) def clear_graphs(self): """