question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: facet-specific legends

See original GitHub issue

After faceting by rows and columns for two variables, and hueing for a third one, some facets might contain only some hue values. It makes little sense then to have one overall FacetGrid legend and diving through it to find the keys for any specific facet. It may be more practical to have the legend of each facet only to show the hue values that appear in that specific facet. This was discussed, and resolved, in a stackoverflow post but it may be nice to make it a feature, possibly to be chosen with an argument of .add_legend() to be passed to the FacetGrid object. legend_in_facets

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mwaskomcommented, Apr 30, 2020

I think this statement is incorrect:

It makes little sense then to have one overall FacetGrid legend and diving through it to find the keys for any specific facet.

It makes the same amount of sense as with other uses of FacetGrid: the figure represents the entire dataset, and the figure legend shows the hue values. Putting a legend in each facet also leads to a very cluttered appearance.

Here is another way to get what you want.

g = sns.FacetGrid(tips, row="sex", col="day")
for (row_var, col_var), facet_df in tips.groupby(["sex", "day"]):
    ax = g.axes[g.row_names.index(row_var), g.col_names.index(col_var)]
    sns.swarmplot(x="time", y="total_bill", hue="size", data=facet_df, ax=ax)
    ax.set(xlabel="", ylabel="")
g.set_axis_labels("time", "total_bill")
g.set_titles()

image

I am going to close this issue, but thanks for the suggestion.

0reactions
massimopintocommented, May 4, 2020

Thank you @mwaskom, I understand that there is more than one solution to this (the answer by @ParfaitG to my original question on Overflow was also updated to work in a more general case). With respect to #2046, I first need to figure out how to deploy seaborn after pulling from a branch different from master (such as facet_grid_convenience) without upsetting my conda installation (now at 0.10.1). Using pip after git checkout facet_grid_convenience perhaps?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Requests: What are they and how to manage them
Feature requests are a form of product feedback you may frequently encounter as a SaaS product manager. They typically come in the form...
Read more >
Feature Requests - Platform and API - Overwolf Developers Q&A
Topic Replies Views Activity How to request a new feature · category‑overvew 3 793 May 23, 2019 C# Plugin Elevated Mode 3 66 December 8,...
Read more >
New Feature Request - Lucidchart Help
As a new user, I'd like to recommend the following features be included ASAP. Auto Sizing / Fit to Column/Row - Using swimlanes,...
Read more >
Feature Request Management - Canny
Feature request software helps you make informed product decisions · One dedicated location for feature request management · All feature requests in one...
Read more >
Feature Request - Matillion Community
Add Archive option to Azure Blob storage component or any other component that pull files from Azure. I know I can turn off...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found