Commit fc7a7bb7 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

HS: Fix update relim in PlotAC and PlotKPC.

Showing with 20 additions and 12 deletions
+20 -12
......@@ -108,23 +108,27 @@ class PlotAC(PamhyrPlot):
def update(self):
if self.line_kp is None:
self.draw()
else:
if self._current_reach is None or self._current_profile is None:
self.clear()
return
return
profile = self._current_profile
x = profile.get_station()
z = profile.z()
if self._current_reach is None or self._current_profile is None:
self.clear()
return
self.line_kp.set_data(x, z)
profile = self._current_profile
x = profile.get_station()
z = profile.z()
self.canvas.axes.set_xlim(
left=min(x), right=max(x)
)
self.canvas.figure.canvas.draw_idle()
self.line_kp.set_data(x, z)
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()
......@@ -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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment