diff --git a/src/View/Geometry/PlotAC.py b/src/View/Geometry/PlotAC.py index 968f16ebf4344763d27011e3a5cef9f1d41795d6..da0eb0bd1598d0bf389bc0d44032af269b630957 100644 --- a/src/View/Geometry/PlotAC.py +++ b/src/View/Geometry/PlotAC.py @@ -63,13 +63,19 @@ class PlotAC(PamhyrPlot): if self.data.number_profiles == 0: return + np = len(self.data.profiles) + if np < 2: + return + selected_profile = 0 + station = self.data.profile(selected_profile).get_station() - station_plus_1 = self.data.profile(selected_profile + 1).get_station() elevation = self.data.profile(selected_profile).z() - elevation_i_plus_1 = self.data.profile(selected_profile + 1).z() gl = self.data.profile(selected_profile).names() + station_plus_1 = self.data.profile(selected_profile + 1).get_station() + elevation_i_plus_1 = self.data.profile(selected_profile + 1).z() + self.canvas.axes.set_xlabel( _translate("MainWindow_reach", "Transverse abscissa (m)"), color='black', fontsize=10 diff --git a/src/View/Geometry/PlotKPZ.py b/src/View/Geometry/PlotKPZ.py index 6825abfa7dcb1aaf049396645c9d2ee3776cbea3..2b4fd6e361bcbc812c3cb8908a6eadd656c5a554 100644 --- a/src/View/Geometry/PlotKPZ.py +++ b/src/View/Geometry/PlotKPZ.py @@ -62,6 +62,17 @@ class PlotKPZ(PamhyrPlot): if self.data.number_profiles == 0: return + profiles_defined = any( + filter( + lambda profile: len(profile.x()) > 0, + self.data.profiles + ) + ) + + if not profiles_defined: + self._init = False + return + self.canvas.axes.set_xlabel( _translate("MainWindow_reach", "Kp (m)"), color='black', fontsize=10 @@ -75,9 +86,9 @@ class PlotKPZ(PamhyrPlot): z_min = self.data.get_z_min() z_max = self.data.get_z_max() - self.canvas.axes.set_xlim( - left=min(kp), right=max(kp) - ) + # self.canvas.axes.set_xlim( + # left=min(kp), right=max(kp) + # ) self.line_kp_zmin_zmax = self.canvas.axes.vlines( x=kp, diff --git a/src/View/Geometry/PlotXY.py b/src/View/Geometry/PlotXY.py index 9aba4652b25c04a014de3c2ed83763f277277e1d..f8cd23df768318f4336263215a1aaf72128bfa16 100644 --- a/src/View/Geometry/PlotXY.py +++ b/src/View/Geometry/PlotXY.py @@ -74,9 +74,9 @@ class PlotXY(PamhyrPlot): self.canvas.axes.axis("equal") kp = self.data.get_kp() - self.canvas.axes.set_xlim( - left=min(kp), right=max(kp) - ) + # self.canvas.axes.set_xlim( + # left=min(kp), right=max(kp) + # ) # Draw line for each profile self.line_xy = [