Repository: scipp/plopp

Issue:
Changing line color in superplot via widget does not update the color of the error bars
![Screenshot at 2023-08-08 15-53-44](https://github.com/scipp/plopp/assets/39047984/a5644f79-1168-4e39-a117-3926808db2b7)


Discussion:

Patch:
diff --git a/src/plopp/backends/matplotlib/line.py b/src/plopp/backends/matplotlib/line.py
index bacaa18..1a6d490 100644
--- a/src/plopp/backends/matplotlib/line.py
+++ b/src/plopp/backends/matplotlib/line.py
@@ -257,5 +257,6 @@ class Line:
     def color(self, val):
         self._line.set_color(val)
         if self._error is not None:
-            self._error.set_color(val)
+            for artist in self._error.get_children():
+                artist.set_color(val)
         self._canvas.draw()


Test patch:
diff --git a/tests/backends/matplotlib/mpl_line_test.py b/tests/backends/matplotlib/mpl_line_test.py
index 9160e49..3636d1a 100644
--- a/tests/backends/matplotlib/mpl_line_test.py
+++ b/tests/backends/matplotlib/mpl_line_test.py
@@ -120,3 +120,27 @@ def test_line_datetime_binedges_with_errorbars():
     # do not seem immediately convertible to datetimes.
     # Hence, we simply check if the Line can be created without raising an exception.
     Line(canvas=Canvas(), data=da)
+
+
+def test_line_color():
+    da = data_array(ndim=1)
+    line = Line(canvas=Canvas(), data=da)
+    assert line.color == 'C0'
+    assert line._line.get_color() == 'C0'
+    line.color = 'C1'
+    assert line.color == 'C1'
+    assert line._line.get_color() == 'C1'
+
+
+def test_line_color_with_errorbars():
+    from matplotlib.colors import to_hex
+
+    da = data_array(ndim=1, variances=True)
+    line = Line(canvas=Canvas(), data=da)
+    assert line.color == 'C0'
+    assert line._line.get_color() == 'C0'
+    assert to_hex(line._error.get_children()[0].get_color()) == to_hex('C0')
+    line.color = 'C1'
+    assert line.color == 'C1'
+    assert line._line.get_color() == 'C1'
+    assert to_hex(line._error.get_children()[0].get_color()) == to_hex('C1')