HS: Fix update relim in PlotAC and PlotKPC.

setup.py
Pierre-Antoine Rouby 2023-12-13 10:05:25 +01:00
parent 5a1c363e8a
commit fc7a7bb7fd
2 changed files with 20 additions and 12 deletions

View File

@ -108,7 +108,8 @@ class PlotAC(PamhyrPlot):
def update(self):
if self.line_kp is None:
self.draw()
else:
return
if self._current_reach is None or self._current_profile is None:
self.clear()
return
@ -119,12 +120,15 @@ class PlotAC(PamhyrPlot):
self.line_kp.set_data(x, z)
self.canvas.axes.set_xlim(
left=min(x), right=max(x)
)
self.canvas.axes.relim()
self.canvas.axes.autoscale_view()
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
def clear(self):
if self.line_kp is not None:
self.line_kp.set_data([], [])
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()

View File

@ -139,6 +139,10 @@ class PlotKPC(PamhyrPlot):
[self._current_profile.kp, self._current_profile.kp],
[self._current_profile.z_min(), self._current_profile.z_max()],
)
self.canvas.axes.relim()
self.canvas.axes.autoscale_view()
self.canvas.figure.canvas.draw_idle()
def clear(self):