diff --git a/src/View/Results/PlotH.py b/src/View/Results/PlotH.py index 3494cfa5ea542896f22d539a24aa06f051649539..f236bf8f3f7871004d56fe72a6202711eb11ef7e 100644 --- a/src/View/Results/PlotH.py +++ b/src/View/Results/PlotH.py @@ -92,31 +92,24 @@ class PlotH(PamhyrPlot): self.ts = list(self.results.get("timestamps")) self.ts.sort() - self.canvas.axes.set_xlim( - left=min(self.ts), right=max(self.ts) - ) - # Draw discharge for each timestamp x = self.ts y = profile.get_key("Q") - if len(self.ts) != len(x): - logger.warning( - "Results as less Q data ({len(x)}) " + - "than timestamps ({len(self.ts)}) " + - "for profile {self._current_profile_id}" - ) - return + self._line, = self.canvas.axes.plot( + x, y, lw=1., + color='r', + markersize=3, marker='+' + ) - self.canvas.axes.set_ylim( - [min(min(y), 0), max(y) + 10] + self._current, = self.canvas.axes.plot( + self._current_timestamp, + y[self.ts.index(self._current_timestamp)], + lw=1., color='b', + markersize=3, marker='+' ) - self._line, = self.canvas.axes.plot( - x, y, lw=1., - color='r', - markersize=3, marker='+' - ) + self.canvas.axes.relim() # Custom time display nb = len(x) @@ -175,12 +168,21 @@ class PlotH(PamhyrPlot): def set_timestamp(self, timestamp): self._current_timestamp = timestamp - # self.update() + self.update() def update(self): reach = self.results.river.reach(self._current_reach_id) profile = reach.profile(self._current_profile_id) + x = self.ts y = profile.get_key("Q") + self._line.set_data(x, y) + + self._current.set_data( + self._current_timestamp, + y[self.ts.index(self._current_timestamp)] + ) + + self.canvas.axes.relim() self.canvas.figure.canvas.draw_idle() diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py index 68a38b34a6fc5c872a59b30c6a52986254a82a82..75e95f2181feef09739553d0f8db434c98dcc2e9 100644 --- a/src/View/Results/Window.py +++ b/src/View/Results/Window.py @@ -396,7 +396,7 @@ class ResultsWindow(PamhyrWindow): self.plot_xy.set_timestamp(timestamp) self.plot_ac.set_timestamp(timestamp) self.plot_kpc.set_timestamp(timestamp) - # self.plot_h.set_timestamp(timestamp) + self.plot_h.set_timestamp(timestamp) if self._study.river.has_sediment(): self.plot_sed_reach.set_timestamp(timestamp)