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

facets and hue with hist #4868

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

dcherian
Copy link
Contributor

@dcherian dcherian commented Feb 5, 2021

@dcherian dcherian changed the title Squashed line refactor facets and hue with hist Feb 5, 2021
Comment on lines +870 to +880
import matplotlib as mpl

def _get_color(obj):
color = obj.get_facecolor()
if color[-1] == 0: # no alpha, invisible
color = obj.get_edgecolor()
return color

handles = primitive[-1]
if "step" in histtype:
handles = [mpl.lines.Line2D([], [], c=_get_color(obj[0])) for obj in handles]
Copy link
Contributor

@Illviljan Illviljan Feb 14, 2021

Choose a reason for hiding this comment

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

Suggested change
import matplotlib as mpl
def _get_color(obj):
color = obj.get_facecolor()
if color[-1] == 0: # no alpha, invisible
color = obj.get_edgecolor()
return color
handles = primitive[-1]
if "step" in histtype:
handles = [mpl.lines.Line2D([], [], c=_get_color(obj[0])) for obj in handles]
plt = import_matplotlib_pyplot()
def _get_color(obj):
color = obj.get_facecolor()
if color[-1] == 0: # no alpha, invisible
color = obj.get_edgecolor()
return color
handles = primitive[-1]
if "step" in histtype:
handles = [plt.Line2D([], [], c=_get_color(obj[0])) for obj in handles]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hue argument for xarray.plot.step() for plotting multiple histograms over shared bins
2 participants