@@ -796,6 +796,24 @@ def test_step_with_where(self, where):
796
796
hdl = self .darray [0 , 0 ].plot .step (where = where )
797
797
assert hdl [0 ].get_drawstyle () == f"steps-{ where } "
798
798
799
+ def test_step_with_hue (self ):
800
+ hdl = self .darray [0 ].plot .step (hue = "dim_2" )
801
+ assert hdl [0 ].get_drawstyle () == "steps-pre"
802
+
803
+ @pytest .mark .parametrize ("where" , ["pre" , "post" , "mid" ])
804
+ def test_step_with_hue_and_where (self , where ):
805
+ hdl = self .darray [0 ].plot .step (hue = "dim_2" , where = where )
806
+ assert hdl [0 ].get_drawstyle () == f"steps-{ where } "
807
+
808
+ def test_drawstyle_steps (self ):
809
+ hdl = self .darray [0 ].plot (hue = "dim_2" , drawstyle = "steps" )
810
+ assert hdl [0 ].get_drawstyle () == "steps"
811
+
812
+ @pytest .mark .parametrize ("where" , ["pre" , "post" , "mid" ])
813
+ def test_drawstyle_steps_with_where (self , where ):
814
+ hdl = self .darray [0 ].plot (hue = "dim_2" , drawstyle = f"steps-{ where } " )
815
+ assert hdl [0 ].get_drawstyle () == f"steps-{ where } "
816
+
799
817
def test_coord_with_interval_step (self ):
800
818
"""Test step plot with intervals."""
801
819
bins = [- 1 , 0 , 1 , 2 ]
@@ -814,6 +832,15 @@ def test_coord_with_interval_step_y(self):
814
832
self .darray .groupby_bins ("dim_0" , bins ).mean (...).plot .step (y = "dim_0_bins" )
815
833
assert len (plt .gca ().lines [0 ].get_xdata ()) == ((len (bins ) - 1 ) * 2 )
816
834
835
+ def test_coord_with_interval_step_x_and_y_raises_valueeerror (self ):
836
+ """Test that step plot with intervals both on x and y axes raises an error."""
837
+ arr = xr .DataArray (
838
+ [pd .Interval (0 , 1 ), pd .Interval (1 , 2 )],
839
+ coords = [("x" , [pd .Interval (0 , 1 ), pd .Interval (1 , 2 )])],
840
+ )
841
+ with pytest .raises (TypeError , match = "intervals against intervals" ):
842
+ arr .plot .step ()
843
+
817
844
818
845
class TestPlotHistogram (PlotTestCase ):
819
846
@pytest .fixture (autouse = True )
0 commit comments