Skip to content

Commit 24e1301

Browse files
committed
Restored setting linestyle or marker to 'None' if only one is given in fmt
1 parent c53dbe0 commit 24e1301

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ def _process_plot_format(fmt):
111111
raise ValueError(
112112
'Unrecognized character %c in format string' % c)
113113

114+
if linestyle is None and marker is not None:
115+
linestyle = 'None'
116+
if marker is None and linestyle is not None:
117+
marker = 'None'
118+
114119
return linestyle, marker, color
115120

116121

lib/matplotlib/tests/test_fmt.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def _fmt_parsing_invalid_helper(fmt):
2020

2121

2222
def test_fmt_parsing():
23-
test_cases = (('-', ('-', None, None)),
24-
('--', ('--', None, None)),
25-
('-.', ('-.', None, None)),
26-
(':', (':', None, None)),
27-
('-g', ('-', None, 'g')),
28-
('--r', ('--', None, 'r')),
29-
('-.k', ('-.', None, 'k')),
30-
(':b', (':', None, 'b')),
23+
test_cases = (('-', ('-', 'None', None)),
24+
('--', ('--', 'None', None)),
25+
('-.', ('-.', 'None', None)),
26+
(':', (':', 'None', None)),
27+
('-g', ('-', 'None', 'g')),
28+
('--r', ('--', 'None', 'r')),
29+
('-.k', ('-.', 'None', 'k')),
30+
(':b', (':', 'None', 'b')),
3131
('-o', ('-', 'o', None)),
3232
('--,', ('--', ',', None)),
3333
('-..', ('-.', '.', None)),
@@ -36,17 +36,17 @@ def test_fmt_parsing():
3636
('--r<', ('--', '<', 'r')),
3737
(':>g', (':', '>', 'g')),
3838
('.-.k', ('-.', '.', 'k')),
39-
('-c', ('-', None, 'c')),
39+
('-c', ('-', 'None', 'c')),
4040
('-1m', ('-', '1', 'm')),
4141
('-y2', ('-', '2', 'y')),
4242
('w-3', ('-', '3', 'w')),
4343
('--.', ('--', '.', None)),
4444
('-4k', ('-', '4', 'k')),
45-
('sk', (None, 's', 'k')),
45+
('sk', ('None', 's', 'k')),
4646
('r', (None, None, 'r')),
4747
('1.0', (None, None, '1.0')),
4848
('0.8', (None, None, '0.8')),
49-
('p', (None, 'p', None)),
49+
('p', ('None', 'p', None)),
5050
('*--', ('--', '*', None)),
5151
('kh:', (':', 'h', 'k')),
5252
('H-r', ('-', 'H', 'r')),

0 commit comments

Comments
 (0)