replaced LINE_STYLE_CYCLE constant with pg_plot_style_cycler function

This commit is contained in:
2023-01-08 13:23:00 +01:00
parent 59948f5b22
commit 2b019fa1db
2 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ class MDISubPlot(MDISubWindow):
from ..theme import LINE_STYLE_CYCLE
from ..theme import pg_plot_style_cycler
class MDISubMultiPlot(MDISubWindow):
@ -23,8 +23,10 @@ class MDISubMultiPlot(MDISubWindow):
title = " | ".join(titles)
super().__init__(title, *args, **kwargs)
psc = pg_plot_style_cycler()
plt = pg.PlotWidget()
self.plots = [d.make_plot(plt, style=s) for d, s in zip(descs, LINE_STYLE_CYCLE)]
self.plots = [d.make_plot(plt, style=s) for d, s in zip(descs, psc)]
self.setWidget(plt)

View File

@ -1,3 +1,4 @@
from itertools import cycle
from PyQt5.QtGui import QPalette, QColor
import pyqtgraph as pg
from . import colors as C
@ -107,12 +108,9 @@ def pg_plot_style(line_color=DOT_PEN, marker_stroke_color=DOT_PEN, marker_fill_c
return style
from itertools import cycle
LINE_STYLES = (pg_plot_style(line_color=c, marker_fill_color=c) for c in LINE_COLORS)
LINE_STYLE_CYCLE = cycle(LINE_STYLES)
def pg_plot_style_cycler(colors=LINE_COLORS):
line_styles = (pg_plot_style(line_color=c, marker_fill_color=c) for c in colors)
return cycle(line_styles)