diff --git a/src/View/Geometry/PlotAC.py b/src/View/Geometry/PlotAC.py index 56f96e391b1dd7f6f6ca03f78c3b4f6edda9e240..da5f1149cf89dacb35d5d6c4254e97e8e50f82cf 100644 --- a/src/View/Geometry/PlotAC.py +++ b/src/View/Geometry/PlotAC.py @@ -327,5 +327,6 @@ class PlotAC(APlot): self.update_annotate_full(0) self.canvas.axes.relim() + self.canvas.axes.autoscale() self.canvas.axes.autoscale_view() self.canvas.figure.canvas.draw_idle() diff --git a/src/View/Geometry/PlotXY.py b/src/View/Geometry/PlotXY.py index 86b93f8d052107fbf2f7f0ff1c962559cc579cf5..4293d8fc3740763ab0d7af3ed417b4f878bbbdac 100644 --- a/src/View/Geometry/PlotXY.py +++ b/src/View/Geometry/PlotXY.py @@ -104,6 +104,8 @@ class PlotXY(APlot): ) self.after_plot_selected.set_visible(False) + self.canvas.axes.autoscale_view(True, True, True) + self.canvas.axes.autoscale() self.canvas.figure.tight_layout() self.canvas.figure.canvas.draw_idle() self.toolbar.update() @@ -119,6 +121,40 @@ class PlotXY(APlot): if self.data is None: return + self.data.compute_guidelines() + x_complete = self.data.get_guidelines_x() + y_complete = self.data.get_guidelines_y() + + for i in range(self.data.number_profiles): + if i < len(self.line_xy): + self.line_xy[i][0].set_data( + self.data.profile(i).x(), + self.data.profile(i).y() + ) + else: + self.line_xy.append( + self.canvas.axes.plot( + self.data.profile(i).x(), + self.data.profile(i).y(), + lw=1., color='r', + markersize=3, marker='+' + ) + ) + + for i in range(len(x_complete)): + if i < len(self.line_gl): + self.line_gl[i][0].set_data( + x_complete[i], + y_complete[i] + ) + else: + self.line_gl.append( + self.canvas.axes.plot( + x_complete[i], + y_complete[i] + ) + ) + if ind is not None and self.display_current: before = ind - 1 after = ind + 1 @@ -141,22 +177,9 @@ class PlotXY(APlot): self.after_plot_selected.set_data(self.data.profile(after).x(), self.data.profile(after).y()) self.after_plot_selected.set_visible(True) - else: - for ind in range(self.data.number_profiles): - self.line_xy[ind][0].set_data( - self.data.profile(ind).x(), - self.data.profile(ind).y() - ) - - self.data.compute_guidelines() - x_complete = self.data.get_guidelines_x() - y_complete = self.data.get_guidelines_y() - - for ind in range(len(self.line_gl)): - self.line_gl[ind][0].set_data( - x_complete[ind], - y_complete[ind] - ) + self.canvas.axes.relim() + self.canvas.axes.autoscale() + self.canvas.axes.autoscale_view() self.canvas.figure.tight_layout() self.canvas.figure.canvas.draw_idle()