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

Skip to content

Commit 711bacb

Browse files
committed
Merge pull request #3855 from smithsp/v1.4.x
ENH : Allow `color=None` to be passed to plotting functions.
2 parents 6c11718 + cd45419 commit 711bacb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ def _xy_from_xy(self, x, y):
232232

233233
def _makeline(self, x, y, kw, kwargs):
234234
kw = kw.copy() # Don't modify the original kw.
235-
if 'color' not in kw and 'color' not in kwargs:
236-
kw['color'] = six.next(self.color_cycle)
235+
kwargs = kwargs.copy()
236+
if kw.get('color', None) is None and kwargs.get('color', None) is None:
237+
kwargs['color'] = kw['color'] = six.next(self.color_cycle)
237238
# (can't use setdefault because it always evaluates
238239
# its second argument)
239240
seg = mlines.Line2D(x, y,

lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,6 +3402,12 @@ def test_pathological_hexbin():
34023402
plt.show()
34033403
assert_equal(len(w), 0)
34043404

3405+
@cleanup
3406+
def test_color_None():
3407+
# issue 3855
3408+
fig, ax = plt.subplots()
3409+
ax.plot([1,2], [1,2], color=None)
3410+
plt.show()
34053411

34063412
if __name__ == '__main__':
34073413
import nose

0 commit comments

Comments
 (0)