Skip to content
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

BUGFIX: line_kws.color is of no effect in distribution plot #3691

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion seaborn/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ def plot_univariate_histogram(
hist_artists = []

# Go back through the dataset and draw the plots
custome_line_color = line_kws.get('color')
for sub_vars, _ in self.iter_data("hue", reverse=True):

key = tuple(sub_vars.items())
Expand Down Expand Up @@ -647,7 +648,11 @@ def plot_univariate_histogram(
line_args = density, support
sticky_x, sticky_y = (0, np.inf), None

line_kws["color"] = to_rgba(sub_color, 1)
if custome_line_color is None:
line_color = sub_color
else:
line_color = custome_line_color
line_kws["color"] = to_rgba(line_color, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment breaks hue KDE line color (when not using line_kws) - it makes all KDE lines use the same color.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. The latest comment fixes this by reading the custom color value out of the hue for loop.

line, = ax.plot(
*line_args, **line_kws,
)
Expand Down