@@ -1981,9 +1981,12 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
1981
1981
1982
1982
.. plot:: mpl_examples/pylab_examples/bar_stacked.py
1983
1983
"""
1984
+ kwargs = cbook .normalize_kwargs (kwargs , mpatches ._patch_alias_map )
1984
1985
if not self ._hold :
1985
1986
self .cla ()
1986
1987
color = kwargs .pop ('color' , None )
1988
+ if color is None :
1989
+ color = self ._get_patches_for_fill .get_next_color ()
1987
1990
edgecolor = kwargs .pop ('edgecolor' , None )
1988
1991
linewidth = kwargs .pop ('linewidth' , None )
1989
1992
@@ -2063,14 +2066,11 @@ def make_iterable(x):
2063
2066
if len (linewidth ) < nbars :
2064
2067
linewidth *= nbars
2065
2068
2066
- if color is None :
2067
- color = [None ] * nbars
2068
- else :
2069
- color = list (mcolors .to_rgba_array (color ))
2070
- if len (color ) == 0 : # until to_rgba_array is changed
2071
- color = [[0 , 0 , 0 , 0 ]]
2072
- if len (color ) < nbars :
2073
- color *= nbars
2069
+ color = list (mcolors .to_rgba_array (color ))
2070
+ if len (color ) == 0 : # until to_rgba_array is changed
2071
+ color = [[0 , 0 , 0 , 0 ]]
2072
+ if len (color ) < nbars :
2073
+ color *= nbars
2074
2074
2075
2075
if edgecolor is None :
2076
2076
edgecolor = [None ] * nbars
@@ -2417,34 +2417,71 @@ def stem(self, *args, **kwargs):
2417
2417
2418
2418
# Popping some defaults
2419
2419
try :
2420
- linefmt = kwargs .pop ('linefmt' , args [0 ])
2421
- except IndexError :
2422
- linefmt = kwargs .pop ('linefmt' , 'b-' )
2420
+ linefmt = kwargs ['linefmt' ]
2421
+ except KeyError :
2422
+ try :
2423
+ linefmt = args [0 ]
2424
+ except IndexError :
2425
+ linecolor = 'C0'
2426
+ linemarker = 'None'
2427
+ linestyle = '-'
2428
+ else :
2429
+ linestyle , linemarker , linecolor = \
2430
+ _process_plot_format (linefmt )
2431
+ else :
2432
+ linestyle , linemarker , linecolor = _process_plot_format (linefmt )
2423
2433
try :
2424
- markerfmt = kwargs .pop ('markerfmt' , args [1 ])
2425
- except IndexError :
2426
- markerfmt = kwargs .pop ('markerfmt' , 'bo' )
2434
+ markerfmt = kwargs ['markerfmt' ]
2435
+ except KeyError :
2436
+ try :
2437
+ markerfmt = args [1 ]
2438
+ except IndexError :
2439
+ markercolor = 'C0'
2440
+ markermarker = 'o'
2441
+ markerstyle = 'None'
2442
+ else :
2443
+ markerstyle , markermarker , markercolor = \
2444
+ _process_plot_format (markerfmt )
2445
+ else :
2446
+ markerstyle , markermarker , markercolor = \
2447
+ _process_plot_format (markerfmt )
2427
2448
try :
2428
- basefmt = kwargs .pop ('basefmt' , args [2 ])
2429
- except IndexError :
2430
- basefmt = kwargs .pop ('basefmt' , 'r-' )
2449
+ basefmt = kwargs ['basefmt' ]
2450
+ except KeyError :
2451
+ try :
2452
+ basefmt = args [2 ]
2453
+ except IndexError :
2454
+ if rcParams ['_internal.classic_mode' ]:
2455
+ basecolor = 'C2'
2456
+ else :
2457
+ basecolor = 'C3'
2458
+ basemarker = 'None'
2459
+ basestyle = '-'
2460
+ else :
2461
+ basestyle , basemarker , basecolor = \
2462
+ _process_plot_format (basefmt )
2463
+ else :
2464
+ basestyle , basemarker , basecolor = _process_plot_format (basefmt )
2431
2465
2432
2466
bottom = kwargs .pop ('bottom' , None )
2433
2467
label = kwargs .pop ('label' , None )
2434
2468
2435
- markerline , = self .plot (x , y , markerfmt , label = "_nolegend_" )
2469
+ markerline , = self .plot (x , y , color = markercolor , linestyle = markerstyle ,
2470
+ marker = markermarker , label = "_nolegend_" )
2436
2471
2437
2472
if bottom is None :
2438
2473
bottom = 0
2439
2474
2440
2475
stemlines = []
2441
2476
for thisx , thisy in zip (x , y ):
2442
- l , = self .plot ([thisx , thisx ], [bottom , thisy ], linefmt ,
2443
- label = "_nolegend_" )
2477
+ l , = self .plot ([thisx , thisx ], [bottom , thisy ],
2478
+ color = linecolor , linestyle = linestyle ,
2479
+ marker = linemarker , label = "_nolegend_" )
2444
2480
stemlines .append (l )
2445
2481
2446
2482
baseline , = self .plot ([np .amin (x ), np .amax (x )], [bottom , bottom ],
2447
- basefmt , label = "_nolegend_" )
2483
+ color = basecolor , linestyle = basestyle ,
2484
+ marker = basemarker , label = "_nolegend_" )
2448
2485
2449
2486
self .hold (remember_hold )
2450
2487
0 commit comments