mirror of https://gitlab.com/pamhyr/pamhyr2
HS: Fix update relim in PlotAC and PlotKPC.
parent
5a1c363e8a
commit
fc7a7bb7fd
|
|
@ -108,23 +108,27 @@ class PlotAC(PamhyrPlot):
|
||||||
def update(self):
|
def update(self):
|
||||||
if self.line_kp is None:
|
if self.line_kp is None:
|
||||||
self.draw()
|
self.draw()
|
||||||
else:
|
return
|
||||||
if self._current_reach is None or self._current_profile is None:
|
|
||||||
self.clear()
|
|
||||||
return
|
|
||||||
|
|
||||||
profile = self._current_profile
|
if self._current_reach is None or self._current_profile is None:
|
||||||
x = profile.get_station()
|
self.clear()
|
||||||
z = profile.z()
|
return
|
||||||
|
|
||||||
self.line_kp.set_data(x, z)
|
profile = self._current_profile
|
||||||
|
x = profile.get_station()
|
||||||
|
z = profile.z()
|
||||||
|
|
||||||
self.canvas.axes.set_xlim(
|
self.line_kp.set_data(x, z)
|
||||||
left=min(x), right=max(x)
|
|
||||||
)
|
self.canvas.axes.relim()
|
||||||
self.canvas.figure.canvas.draw_idle()
|
self.canvas.axes.autoscale_view()
|
||||||
|
|
||||||
|
self.canvas.figure.tight_layout()
|
||||||
|
self.canvas.figure.canvas.draw_idle()
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
if self.line_kp is not None:
|
if self.line_kp is not None:
|
||||||
self.line_kp.set_data([], [])
|
self.line_kp.set_data([], [])
|
||||||
|
|
||||||
|
self.canvas.figure.tight_layout()
|
||||||
self.canvas.figure.canvas.draw_idle()
|
self.canvas.figure.canvas.draw_idle()
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,10 @@ class PlotKPC(PamhyrPlot):
|
||||||
[self._current_profile.kp, self._current_profile.kp],
|
[self._current_profile.kp, self._current_profile.kp],
|
||||||
[self._current_profile.z_min(), self._current_profile.z_max()],
|
[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()
|
self.canvas.figure.canvas.draw_idle()
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue