Results: CustomPlot: Use automatic x and y lim.

setup.py
Pierre-Antoine Rouby 2024-05-03 14:40:20 +02:00
parent a0cdb182fd
commit ba81f923d9
1 changed files with 26 additions and 26 deletions

View File

@ -77,9 +77,9 @@ class CustomPlot(PamhyrPlot):
kp = reach.geometry.get_kp() kp = reach.geometry.get_kp()
z_min = reach.geometry.get_z_min() z_min = reach.geometry.get_z_min()
self.canvas.axes.set_xlim( # self.canvas.axes.set_xlim(
left=min(kp), right=max(kp) # left=min(kp), right=max(kp)
) # )
meter_axes = self.canvas.axes meter_axes = self.canvas.axes
m3S_axes = self.canvas.axes m3S_axes = self.canvas.axes
@ -88,10 +88,10 @@ class CustomPlot(PamhyrPlot):
lines = {} lines = {}
if "elevation" in self._y: if "elevation" in self._y:
meter_axes.set_ylim( # meter_axes.set_ylim(
bottom=min(0, min(z_min)), # bottom=min(0, min(z_min)),
top=max(z_min) + 1 # top=max(z_min) + 1
) # )
line = meter_axes.plot( line = meter_axes.plot(
kp, z_min, kp, z_min,
@ -108,10 +108,10 @@ class CustomPlot(PamhyrPlot):
) )
) )
meter_axes.set_ylim( # meter_axes.set_ylim(
bottom=min(0, min(z_min)), # bottom=min(0, min(z_min)),
top=max(water_z) + 1 # top=max(water_z) + 1
) # )
line = meter_axes.plot( line = meter_axes.plot(
kp, water_z, lw=1., kp, water_z, lw=1.,
@ -133,10 +133,10 @@ class CustomPlot(PamhyrPlot):
) )
) )
m3s_axes.set_ylim( # m3s_axes.set_ylim(
bottom=min(0, min(q)), # bottom=min(0, min(q)),
top=max(q) + 1 # top=max(q) + 1
) # )
line = m3s_axes.plot( line = m3s_axes.plot(
kp, q, lw=1., kp, q, lw=1.,
@ -206,9 +206,9 @@ class CustomPlot(PamhyrPlot):
ts = list(results.get("timestamps")) ts = list(results.get("timestamps"))
ts.sort() ts.sort()
self.canvas.axes.set_xlim( # self.canvas.axes.set_xlim(
left=min(ts), right=max(ts) # left=min(ts), right=max(ts)
) # )
x = ts x = ts
lines = {} lines = {}
@ -232,10 +232,10 @@ class CustomPlot(PamhyrPlot):
# Water elevation # Water elevation
z = profile.get_key("Z") z = profile.get_key("Z")
meter_axes.set_ylim( # meter_axes.set_ylim(
bottom=min(0, min(z)), # bottom=min(0, min(z)),
top=max(z) + 1 # top=max(z) + 1
) # )
line = meter_axes.plot( line = meter_axes.plot(
ts, z, lw=1., ts, z, lw=1.,
@ -260,10 +260,10 @@ class CustomPlot(PamhyrPlot):
if "discharge" in self._y: if "discharge" in self._y:
q = profile.get_key("Q") q = profile.get_key("Q")
m3s_axes.set_ylim( # m3s_axes.set_ylim(
bottom=min(0, min(q)), # bottom=min(0, min(q)),
top=max(q) + 1 # top=max(q) + 1
) # )
line = m3s_axes.plot( line = m3s_axes.plot(
ts, q, lw=1., ts, q, lw=1.,