@@ -9618,3 +9618,29 @@ def test_axes_set_position_external_bbox_unchanged(fig_test, fig_ref):
96189618 ax_test .set_position ([0.25 , 0.25 , 0.5 , 0.5 ])
96199619 assert (bbox .x0 , bbox .y0 , bbox .width , bbox .height ) == (0.0 , 0.0 , 1.0 , 1.0 )
96209620 ax_ref = fig_ref .add_axes ([0.25 , 0.25 , 0.5 , 0.5 ])
9621+
9622+
9623+ def test_caps_color ():
9624+ # Creates a simple plot with error bars and a specified ecolor
9625+ x = np .linspace (0 , 10 , 10 )
9626+ mpl .rcParams ['lines.markeredgecolor' ] = 'green'
9627+ ecolor = 'red'
9628+
9629+ fig , ax = plt .subplots ()
9630+ errorbars = ax .errorbar (x , np .sin (x ), yerr = 0.1 , ecolor = ecolor )
9631+
9632+ # Tests if the caps have the specified color
9633+ for cap in errorbars [2 ]:
9634+ assert mcolors .same_color (cap .get_edgecolor (), ecolor )
9635+
9636+
9637+ def test_caps_no_ecolor ():
9638+ # Creates a simple plot with error bars without specifying ecolor
9639+ x = np .linspace (0 , 10 , 10 )
9640+ mpl .rcParams ['lines.markeredgecolor' ] = 'green'
9641+ fig , ax = plt .subplots ()
9642+ errorbars = ax .errorbar (x , np .sin (x ), yerr = 0.1 )
9643+
9644+ # Tests if the caps have the default color (blue)
9645+ for cap in errorbars [2 ]:
9646+ assert mcolors .same_color (cap .get_edgecolor (), "blue" )
0 commit comments