From 3fb95b0149b11d38c4caca9ad533ecf9782cda8e Mon Sep 17 00:00:00 2001 From: Sietze van Buuren Date: Wed, 27 Nov 2024 20:26:08 +0100 Subject: [PATCH] fix: correct defintion of line colors for 2D axes Signed-off-by: Sietze van Buuren --- mlpyqtgraph/axes.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mlpyqtgraph/axes.py b/mlpyqtgraph/axes.py index 5d9490e..9db3537 100644 --- a/mlpyqtgraph/axes.py +++ b/mlpyqtgraph/axes.py @@ -29,14 +29,17 @@ class Axis2D(pg.PlotItem): '--': QtCore.Qt.DashLine, ':': QtCore.Qt.DotLine, '.-': QtCore.Qt.DashDotLine} - colors_defs = colors.ColorDefinitions() - line_colors = colors_defs.get_line_colors() - scale_box_line_color = colors_defs.get_scale_box_colors(part='line') - scale_box_fill_color = colors_defs.get_scale_box_colors(part='fill') + def __init__(self, index, **kwargs): parent = kwargs.pop('parent', None) super().__init__(parent=parent, **kwargs) self.index = index + self.colors_defs = colors.ColorDefinitions() + self.line_colors = self.colors_defs.get_line_colors() + self.scale_box_line_color = \ + self.colors_defs.get_scale_box_colors(part='line') + self.scale_box_fill_color = \ + self.colors_defs.get_scale_box_colors(part='fill') self.setup() def setup(self, padding=0.01):