8000 Use new colour styles in stem plots. · matplotlib/matplotlib@41993b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41993b2

Browse files
committed
Use new colour styles in stem plots.
1 parent b2bf14a commit 41993b2

File tree

1 file changed

+50
-13
lines changed

1 file changed

+50
-13
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,34 +2415,71 @@ def stem(self, *args, **kwargs):
24152415

24162416
# Popping some defaults
24172417
try:
2418-
linefmt = kwargs.pop('linefmt', args[0])
2419-
except IndexError:
2420-
linefmt = kwargs.pop('linefmt', 'b-')
2418+
linefmt = kwargs['linefmt']
2419+
except KeyError:
2420+
try:
2421+
linefmt = args[0]
2422+
except IndexError:
2423+
linecolor = 'C0'
2424+
linemarker = 'None'
2425+
linestyle = '-'
2426+
else:
2427+
linestyle, linemarker, linecolor = \
2428+
_process_plot_format(linefmt)
2429+
else:
2430+
linestyle, linemarker, linecolor = _process_plot_format(linefmt)
24212431
try:
2422-
markerfmt = kwargs.pop('markerfmt', args[1])
2423-
except IndexError:
2424-
markerfmt = kwargs.pop('markerfmt', 'bo')
2432+
markerfmt = kwargs['markerfmt']
2433+
except KeyError:
2434+
try:
2435+
markerfmt = args[1]
2436+
except IndexError:
2437+
markercolor = 'C0'
2438+
markermarker = 'o'
2439+
markerstyle = 'None'
2440+
else:
2441+
markerstyle, markermarker, markercolor = \
2442+
_process_plot_format(markerfmt)
2443+
else:
2444+
markerstyle, markermarker, markercolor = \
2445+
_process_plot_format(markerfmt)
24252446
try:
2426-
basefmt = kwargs.pop('basefmt', args[2])
2427-
except IndexError:
2428-
basefmt = kwargs.pop('basefmt', 'r-')
2447+
basefmt = kwargs['basefmt']
2448+
except KeyError:
2449+
try:
2450+
basefmt = args[2]
2451+
except IndexError:
2452+
if rcParams['_internal.classic_mode']:
2453+
basecolor = 'C2'
2454+
else:
2455+
basecolor = 'C3'
2456+
basemarker = 'None'
2457+
basestyle = '-'
2458+
else:
2459+
basestyle, basemarker, basecolor = \
2460+
_process_plot_format(basefmt)
2461+
else:
2462+
basestyle, basemarker, basecolor = _process_plot_format(basefmt)
24292463

24302464
bottom = kwargs.pop('bottom', None)
24312465
label = kwargs.pop('label', None)
24322466

2433-
markerline, = self.plot(x, y, markerfmt, label="_nolegend_")
2467+
markerline, = self.plot(x, y, color=markercolor, linestyle=markerstyle,
2468+
marker=markermarker, label="_nolegend_")
24342469

24352470
if bottom is None:
24362471
bottom = 0
24372472

24382473
stemlines = []
24392474
for thisx, thisy in zip(x, y):
2440-
l, = self.plot([thisx, thisx], [bottom, thisy], linefmt,
2441-
label="_nolegend_")
2475+
l, = self.plot([thisx, thisx], [bottom, thisy],
2476+
color=linecolor, linestyle=linestyle,
2477+
marker=linemarker, label="_nolegend_")
24422478
stemlines.append(l)
24432479

24442480
baseline, = self.plot([np.amin(x), np.amax(x)], [bottom, bottom],
2445-
basefmt, label="_nolegend_")
2481+
color=basecolor, linestyle=basestyle,
2482+
marker=basemarker, label="_nolegend_")
24462483

24472484
self.hold(remember_hold)
24482485

0 commit comments

Comments
 (0)
0