@@ -3389,6 +3389,23 @@ def test_errorbar_with_prop_cycle(fig_test, fig_ref):
33893389 ax .set_xlim (1 , 11 )
33903390
33913391
3392+ def test_errorbar_every_invalid ():
3393+ x = np .linspace (0 , 1 , 15 )
3394+ y = x * (1 - x )
3395+ yerr = y / 6
3396+
3397+ ax = plt .figure ().subplots ()
3398+
3399+ with pytest .raises (ValueError , match = 'not a tuple of two integers' ):
3400+ ax .errorbar (x , y , yerr , errorevery = (1 , 2 , 3 ))
3401+ with pytest .raises (ValueError , match = 'not a tuple of two integers' ):
3402+ ax .errorbar (x , y , yerr , errorevery = (1.3 , 3 ))
3403+ with pytest .raises (ValueError , match = 'not a valid NumPy fancy index' ):
3404+ ax .errorbar (x , y , yerr , errorevery = [False , True ])
3405+ with pytest .raises (ValueError , match = 'not a recognized value' ):
3406+ ax .errorbar (x , y , yerr , errorevery = 'foobar' )
3407+
3408+
33923409@check_figures_equal ()
33933410def test_errorbar_every (fig_test , fig_ref ):
33943411 x = np .linspace (0 , 1 , 15 )
@@ -3401,7 +3418,7 @@ def test_errorbar_every(fig_test, fig_ref):
34013418 for color , shift in zip ('rgbk' , [0 , 0 , 2 , 7 ]):
34023419 y += .02
34033420
3404- # Using feature in question
3421+ # Check errorevery using an explicit offset and step.
34053422 ax_test .errorbar (x , y , yerr , errorevery = (shift , 4 ),
34063423 capsize = 4 , c = color )
34073424
@@ -3416,6 +3433,22 @@ def test_errorbar_every(fig_test, fig_ref):
34163433 ax_ref .plot (x [1 ::4 ], y [1 ::4 ] + 0.1 , 'o' , zorder = 2.1 )
34173434 ax_ref .errorbar (x , y + 0.1 , yerr , capsize = 4 , fmt = 'none' )
34183435
3436+ # Check that passing a slice to markevery/errorevery works.
3437+ ax_test .errorbar (x , y + 0.2 , yerr , errorevery = slice (2 , None , 3 ),
3438+ markevery = slice (2 , None , 3 ),
3439+ capsize = 4 , c = 'C0' , fmt = 'o' )
3440+ ax_ref .plot (x [2 ::3 ], y [2 ::3 ] + 0.2 , 'o' , c = 'C0' , zorder = 2.1 )
3441+ ax_ref .errorbar (x [2 ::3 ], y [2 ::3 ] + 0.2 , yerr [2 ::3 ],
3442+ capsize = 4 , c = 'C0' , fmt = 'none' )
3443+
3444+ # Check that passing an iterable to markevery/errorevery works.
3445+ ax_test .errorbar (x , y + 0.2 , yerr , errorevery = [False , True , False ] * 5 ,
3446+ markevery = [False , True , False ] * 5 ,
3447+ capsize = 4 , c = 'C1' , fmt = 'o' )
3448+ ax_ref .plot (x [1 ::3 ], y [1 ::3 ] + 0.2 , 'o' , c = 'C1' , zorder = 2.1 )
3449+ ax_ref .errorbar (x [1 ::3 ], y [1 ::3 ] + 0.2 , yerr [1 ::3 ],
3450+ capsize = 4 , c = 'C1' , fmt = 'none' )
3451+
34193452
34203453@image_comparison (['hist_stacked_stepfilled' , 'hist_stacked_stepfilled' ])
34213454def test_hist_stacked_stepfilled ():
0 commit comments