Skip to content

Commit ccb1072

Browse files
committed
Merge pull request #6499 from tacaswell/mnt_cn_passthrough
Mnt cn passthrough
2 parents 14664e2 + dfa14fe commit ccb1072

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

lib/matplotlib/axes/_base.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,9 @@ def __setstate__(self, state):
164164
def set_prop_cycle(self, *args, **kwargs):
165165
if not (args or kwargs) or (len(args) == 1 and args[0] is None):
166166
prop_cycler = rcParams['axes.prop_cycle']
167-
if prop_cycler is None and 'axes.color_cycle' in rcParams:
168-
clist = rcParams['axes.color_cycle']
169-
prop_cycler = cycler('color', clist)
170167
else:
171168
prop_cycler = cycler(*args, **kwargs)
172169

173-
# Make sure the cycler always has at least one color
174-
if 'color' not in prop_cycler.keys:
175-
prop_cycler = prop_cycler * cycler('color', ['k'])
176-
177170
self.prop_cycler = itertools.cycle(prop_cycler)
178171
# This should make a copy
179172
self._prop_keys = prop_cycler.keys
@@ -203,6 +196,8 @@ def get_next_color(self):
203196
"""
204197
Return the next color in the cycle.
205198
"""
199+
if 'color' not in self._prop_keys:
200+
return 'k'
206201
return six.next(self.prop_cycler)['color']
207202

208203
def set_lineprops(self, line, **kwargs):

lib/matplotlib/colors.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,8 @@ def to_rgba(c, alpha=None):
126126
# Special-case nth color syntax because it should not be cached.
127127
if _is_nth_color(c):
128128
from matplotlib import rcParams
129-
from matplotlib.rcsetup import cycler
130129
prop_cycler = rcParams['axes.prop_cycle']
131-
if prop_cycler is None and 'axes.color_cycle' in rcParams:
132-
clist = rcParams['axes.color_cycle']
133-
prop_cycler = cycler('color', clist)
134-
colors = prop_cycler._transpose().get('color', 'k')
130+
colors = prop_cycler.by_key().get('color', ['k'])
135131
c = colors[int(c[1]) % len(colors)]
136132
try:
137133
rgba = _colors_full_map.cache[c, alpha]

lib/matplotlib/tests/test_cycles.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ def test_linestylecycle_basic():
6969
ax.set_prop_cycle(cycler('ls', ['-', '--', ':']))
7070
xs = np.arange(10)
7171
ys = 0.25 * xs + 2
72-
ax.plot(xs, ys, label='solid', lw=4)
72+
ax.plot(xs, ys, label='solid', lw=4, color='k')
7373
ys = 0.45 * xs + 3
74-
ax.plot(xs, ys, label='dashed', lw=4)
74+
ax.plot(xs, ys, label='dashed', lw=4, color='k')
7575
ys = 0.65 * xs + 4
76-
ax.plot(xs, ys, label='dotted', lw=4)
76+
ax.plot(xs, ys, label='dotted', lw=4, color='k')
7777
ys = 0.85 * xs + 5
78-
ax.plot(xs, ys, label='solid2', lw=4)
78+
ax.plot(xs, ys, label='solid2', lw=4, color='k')
7979
ax.legend(loc='upper left')
8080

8181

@@ -130,8 +130,8 @@ def test_property_collision_plot():
130130
ax.set_prop_cycle('linewidth', [2, 4])
131131
for c in range(1, 4):
132132
ax.plot(np.arange(10), c * np.arange(10), lw=0.1, color='k')
133-
ax.plot(np.arange(10), 4 * np.arange(10))
134-
ax.plot(np.arange(10), 5 * np.arange(10))
133+
ax.plot(np.arange(10), 4 * np.arange(10), color='k')
134+
ax.plot(np.arange(10), 5 * np.arange(10), color='k')
135135

136136

137137
@image_comparison(baseline_images=['property_collision_fill'],

0 commit comments

Comments
 (0)