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

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 301bf04

Browse files
committed
Use new colour styles in stem plots.
1 parent b9823d8 commit 301bf04

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
@@ -2416,34 +2416,71 @@ def stem(self, *args, **kwargs):
24162416

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

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

2434-
markerline, = self.plot(x, y, markerfmt, label="_nolegend_")
2468+
markerline, = self.plot(x, y, color=markercolor, linestyle=markerstyle,
2469+
marker=markermarker, label="_nolegend_")
24352470

24362471
if bottom is None:
24372472
bottom = 0
24382473

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

24452481
baseline, = self.plot([np.amin(x), np.amax(x)], [bottom, bottom],
2446-
basefmt, label="_nolegend_")
2482+
color=basecolor, linestyle=basestyle,
2483+
marker=basemarker, label="_nolegend_")
24472484

24482485
self.hold(remember_hold)
24492486

0 commit comments

Comments
 (0)
0