@@ -3271,6 +3271,34 @@ def test_plot_no_numeric_data(self):
3271
3271
with pytest .raises (TypeError ):
3272
3272
df .plot ()
3273
3273
3274
+ def test_missing_markers_legend (self ):
3275
+ # 14958
3276
+ df = pd .DataFrame (np .random .randn (8 , 3 ), columns = ["A" , "B" , "C" ])
3277
+ ax = df .plot (y = ["A" ], marker = "x" , linestyle = "solid" )
3278
+ df .plot (y = ["B" ], marker = "o" , linestyle = "dotted" , ax = ax )
3279
+ df .plot (y = ["C" ], marker = "<" , linestyle = "dotted" , ax = ax )
3280
+
3281
+ self ._check_legend_labels (ax , labels = ["A" , "B" , "C" ])
3282
+ self ._check_legend_marker (ax , expected_markers = ["x" , "o" , "<" ])
3283
+
3284
+ def test_missing_markers_legend_using_style (self ):
3285
+ # 14563
3286
+ df = pd .DataFrame (
3287
+ {
3288
+ "A" : [1 , 2 , 3 , 4 , 5 , 6 ],
3289
+ "B" : [2 , 4 , 1 , 3 , 2 , 4 ],
3290
+ "C" : [3 , 3 , 2 , 6 , 4 , 2 ],
3291
+ "X" : [1 , 2 , 3 , 4 , 5 , 6 ],
3292
+ }
3293
+ )
3294
+
3295
+ fig , ax = self .plt .subplots ()
3296
+ for kind in "ABC" :
3297
+ df .plot ("X" , kind , label = kind , ax = ax , style = "." )
3298
+
3299
+ self ._check_legend_labels (ax , labels = ["A" , "B" , "C" ])
3300
+ self ._check_legend_marker (ax , expected_markers = ["." , "." , "." ])
3301
+
3274
3302
3275
3303
def _generate_4_axes_via_gridspec ():
3276
3304
import matplotlib .pyplot as plt
0 commit comments