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

Skip to content

Fix validation of Line2D color. #20198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,7 @@ def set_color(self, color):
----------
color : color
"""
if not cbook._str_equal(color, 'auto'):
mcolors._check_color_like(color=color)
mcolors._check_color_like(color=color)
self._color = color
self.stale = True

Expand Down
12 changes: 10 additions & 2 deletions lib/mpl_toolkits/axisartist/axis_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@

import numpy as np

from matplotlib import _api, rcParams
from matplotlib import _api, cbook, rcParams
import matplotlib.artist as martist
import matplotlib.colors as mcolors
import matplotlib.text as mtext

from matplotlib.collections import LineCollection
from matplotlib.lines import Line2D
from matplotlib.patches import PathPatch
Expand Down Expand Up @@ -134,6 +134,14 @@ def get_ref_artist(self):
# docstring inherited
return self._axis.majorTicks[0].tick1line

def set_color(self, color):
# docstring inherited
# Unlike the base Line2D.set_color, this also supports "auto".
if not cbook._str_equal(color, "auto"):
mcolors._check_color_like(color=color)
self._color = color
self.stale = True

def get_color(self):
return self.get_attribute_from_ref_artist("color")

Expand Down