Plot: Add a default colors set and delete geo:plot_xy dependence on geo:plot_ac.

setup.py
Pierre-Antoine Rouby 2024-02-14 16:44:41 +01:00
parent 30d76da32f
commit c58dc5785a
5 changed files with 14 additions and 18 deletions

View File

@ -32,7 +32,7 @@ logger = logging.getLogger()
class PlotAC(PamhyrPlot):
def __init__(self, canvas=None, trad=None, data=None, toolbar=None,
plot_xy=None, parent=None):
parent=None):
super(PlotAC, self).__init__(
canvas=canvas,
trad=trad,
@ -46,8 +46,6 @@ class PlotAC(PamhyrPlot):
self._auto_relim_update = True
self._autoscale_update = True
self.plot_xy = plot_xy
self.label_x = _translate(
"Geometry", "Transverse abscissa (m)"
)
@ -67,18 +65,9 @@ class PlotAC(PamhyrPlot):
self.plot_selected = None
self.next_plot_selected = None
def get_line_gl_colors(self, line_2d):
colors = []
for line in line_2d:
colors.append(line[0].get_color())
return colors
@timer
def draw(self):
self.canvas.axes.cla()
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
self.init_axes()
if self.data.number_profiles == 0:
return
@ -140,8 +129,7 @@ class PlotAC(PamhyrPlot):
lcomplete = list(self.complete_gl)
lincomplete = list(self.incomplete_gl)
line_2d = self.plot_xy.line_gl
self.color_complete_gl = self.get_line_gl_colors(line_2d)
self.color_complete_gl = self.colors
self.color_incomplete_gl = 2 * ["grey"]
x_gl_complete = []

View File

@ -164,6 +164,8 @@ class PlotKPZ(PamhyrPlot):
def draw_gl(self):
kp = self.data.get_kp_complete_profiles()
ind = 0
self.line_kp_zgl = []
for z in self.data.get_guidelines_z():
# Is incomplete guideline?
@ -172,9 +174,10 @@ class PlotKPZ(PamhyrPlot):
self.line_kp_zgl.append(
self.canvas.axes.plot(
kp, z, lw=1.
kp, z, lw=1., color=self.colors[ind]
)
)
ind += 1
def draw_bottom(self):
kp = self.data.get_kp_complete_profiles()

View File

@ -92,12 +92,14 @@ class PlotXY(PamhyrPlot):
x_complete = self.data.get_guidelines_x()
y_complete = self.data.get_guidelines_y()
ind = 0
self.line_gl = []
for x, y in zip(x_complete, y_complete):
line = self.canvas.axes.plot(
x, y,
x, y, color=self.colors[ind]
)
self.line_gl.append(line)
ind += 1
def draw_current(self):
# Previous profile

View File

@ -363,7 +363,6 @@ class GeometryWindow(PamhyrWindow):
canvas=self._canvas_ac,
data=self._reach,
toolbar=self._toolbar_ac,
plot_xy=self._plot_xy
)
self._plot_ac.draw()

View File

@ -16,6 +16,8 @@
# -*- coding: utf-8 -*-
import matplotlib.colors as mplcolors
from View.Tools.Plot.APlot import APlot
from View.Tools.Plot.PamhyrCanvas import MplCanvas
from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar
@ -31,6 +33,8 @@ class PamhyrPlot(APlot):
color_plot_current = "blue"
color_plot_next = "purple"
colors = list(mplcolors.TABLEAU_COLORS)
plot_default_kargs = {
"lw" : 1.,
"markersize" : 3,