Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0bb268

Browse files
committed
Updated the fill test to get the hatching.
Explicitly deprecated axes.color_cycle
1 parent 6956367 commit b0bb268

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
import contextlib
117117
import distutils.sysconfig
118118

119+
from cycler import cycler
120+
119121
# cbook must import matplotlib only within function
120122
# definitions, so it is safe to import from it here.
121123
from matplotlib.cbook import is_string_like, mplDeprecation
@@ -826,6 +828,8 @@ def matplotlib_fname():
826828
'svg.embed_char_paths': ('svg.fonttype',
827829
lambda x: "path" if x else "none", None),
828830
'savefig.extension': ('savefig.format', lambda x: x, None),
831+
'axes.color_cycle': ('axes.prop_cycle', lambda x: cycler('color', x),
832+
lambda x: [c.get('color', None) for c in x),
829833
}
830834

831835
_deprecated_ignore_map = {

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ def set_prop_cycle(self, prop_cycler=None):
156156
clist = rcParams['axes.color_cycle']
157157
prop_cycler = cycler('color', clist)
158158
self.prop_cycler = itertools.cycle(prop_cycler)
159-
# Make a copy
160-
self._prop_keys = list(prop_cycler.keys)
159+
# This should make a copy
160+
self._prop_keys = prop_cycler.keys
161161

162162
def __call__(self, *args, **kwargs):
163163

lib/matplotlib/tests/test_cycles.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ def test_linestylecycle_basic():
4444
def test_fillcycle_basic():
4545
fig = plt.figure()
4646
ax = fig.add_subplot(111)
47-
ax.set_prop_cycle(cycler('color', ['red', 'green', 'yellow']))# +
48-
#cycler('hatch', ['xx', 'O', '|-']))
47+
ax.set_prop_cycle(cycler('color', ['r', 'g', 'y']) +
48+
cycler('hatch', ['xx', 'O', '|-']))
4949
xs = np.arange(10)
5050
ys = 0.25 * xs**.5 + 2
51-
ax.fill(xs, ys, label='red, x')
51+
ax.fill(xs, ys, label='red, x', facecolor='none')
5252
ys = 0.45 * xs**.5 + 3
53-
ax.fill(xs, ys, label='green, circle')
53+
ax.fill(xs, ys, label='green, circle', facecolor='none')
5454
ys = 0.65 * xs**.5 + 4
55-
ax.fill(xs, ys, label='yellow, cross')
55+
ax.fill(xs, ys, label='yellow, cross', facecolor='none')
5656
ys = 0.85 * xs**.5 + 5
57-
ax.fill(xs, ys, label='red2, x2')
57+
ax.fill(xs, ys, label='red2, x2', facecolor='none')
5858
ax.legend(loc='upper left')
5959

6060

0 commit comments

Comments
 (0)