From 0e75d67671a4dd07f124b1a3d77de74924b33f32 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Fri, 3 May 2024 14:56:11 +0200 Subject: [PATCH] Geometry: Fix display with more than 10 guidelines. --- src/View/Geometry/PlotAC.py | 2 +- src/View/Geometry/PlotKPZ.py | 4 +++- src/View/Geometry/PlotXY.py | 3 ++- src/View/Tools/PamhyrPlot.py | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/View/Geometry/PlotAC.py b/src/View/Geometry/PlotAC.py index 24567bef..cccffe24 100644 --- a/src/View/Geometry/PlotAC.py +++ b/src/View/Geometry/PlotAC.py @@ -129,7 +129,7 @@ class PlotAC(PamhyrPlot): if txt.strip() in self.complete_gl: color = self.color_complete_gl[ - lcomplete.index(txt) + lcomplete.index(txt) % len(self.color_complete_gl) ] else: color = self.color_incomplete_gl[ diff --git a/src/View/Geometry/PlotKPZ.py b/src/View/Geometry/PlotKPZ.py index 35e9ffab..f4dbd790 100644 --- a/src/View/Geometry/PlotKPZ.py +++ b/src/View/Geometry/PlotKPZ.py @@ -167,7 +167,9 @@ class PlotKPZ(PamhyrPlot): self.line_kp_zgl.append( self.canvas.axes.plot( - kp, z, lw=1., color=self.colors[ind] + kp, z, lw=1., + color=self.colors[ind % len(self.colors)], + linestyle=self.linestyle[ind // len(self.colors)] ) ) ind += 1 diff --git a/src/View/Geometry/PlotXY.py b/src/View/Geometry/PlotXY.py index 3bf49cbb..0d4a4302 100644 --- a/src/View/Geometry/PlotXY.py +++ b/src/View/Geometry/PlotXY.py @@ -98,7 +98,8 @@ class PlotXY(PamhyrPlot): self.line_gl = [] for x, y in zip(x_complete, y_complete): line = self.canvas.axes.plot( - x, y, color=self.colors[ind] + x, y, color=self.colors[ind % len(self.colors)], + linestyle=self.linestyle[ind // len(self.colors)] ) self.line_gl.append(line) ind += 1 diff --git a/src/View/Tools/PamhyrPlot.py b/src/View/Tools/PamhyrPlot.py index 08232273..59883f6e 100644 --- a/src/View/Tools/PamhyrPlot.py +++ b/src/View/Tools/PamhyrPlot.py @@ -40,6 +40,7 @@ class PamhyrPlot(APlot): color_plot_river_water_zone = "skyblue" colors = list(mplcolors.TABLEAU_COLORS) + linestyle = ['solid', 'dotted', 'dashed', 'dashdot'] plot_default_kargs = { "lw": 1., -- GitLab