Skip to content

Commit

Permalink
Merge pull request #4198 from efiring/plot_color_alias
Browse files Browse the repository at this point in the history
FIX : convert 'c' to 'color' immediately in plot

closes #4162, closes #4157, closes #4262
  • Loading branch information
tacaswell committed Mar 23, 2015
1 parent 5852d83 commit 3f03e2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/matplotlib/axes/_axes.py
Expand Up @@ -1370,6 +1370,12 @@ def plot(self, *args, **kwargs):
self.cla()
lines = []

# Convert "c" alias to "color" immediately, to avoid
# confusion farther on.
c = kwargs.pop('c', None)
if c is not None:
kwargs['color'] = c

for line in self._get_lines(*args, **kwargs):
self.add_line(line)
lines.append(line)
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Expand Up @@ -3433,6 +3433,13 @@ def test_color_None():
ax.plot([1,2], [1,2], color=None)
plt.show()

@cleanup
def test_color_alias():
# issues 4157 and 4162
fig, ax = plt.subplots()
line = ax.plot([0, 1], c='lime')[0]
assert_equal('lime', line.get_color())

@cleanup
def test_numerical_hist_label():
fig, ax = plt.subplots()
Expand Down

0 comments on commit 3f03e2e

Please sign in to comment.