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

Add relplot function #1477

Merged
merged 11 commits into from
Jul 3, 2018
Merged

Add relplot function #1477

merged 11 commits into from
Jul 3, 2018

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Jul 2, 2018

This PR adds the relplot function, for combining scatterplot or lineplot with a FacetGrid, similar to the relationship between factorplot and the axes-level categorical plots. This makes it easy and robust to facet relational plots with multiple semantic variables:

diamonds = sns.load_dataset("diamonds")
clarity_ranking = ["I1", "SI2", "SI1", "VS2", "VS1", "VVS2", "VVS1", "IF"]
g = sns.relplot(x="carat", y="price",
                hue="clarity", size="depth", col="color",
                height=3.5, aspect=.9, col_wrap=3,
                palette="ch:.2,-.2,d=.3_r",
                hue_order=clarity_ranking,
                linewidth=0, sizes=(5, 20),
                data=diamonds.sort_values("color"))

image

fmri = sns.load_dataset("fmri")
sns.relplot(x="timepoint", y="signal",
            hue="event", style="event",
            col="region", units="subject",
            kind="line", estimator=None,
            height=5, aspect=.8, data=fmri)

image

This addition necessitated an API change in FacetGrid, because there was a conflict with the size parameter name. This prompted a uniform substitution of height for size across grid functions, which has the benefit of being more explicit about what that parameter does. It also fixes a problem in factorplot where there was an existing conflict where size was used for the marker radius. The change should not break existing code, as size is handled and converted set to height. with a warning issued.

@codecov
Copy link

codecov bot commented Jul 2, 2018

Codecov Report

Merging #1477 into master will decrease coverage by 0.31%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1477      +/-   ##
==========================================
- Coverage   94.51%   94.19%   -0.32%     
==========================================
  Files          15       15              
  Lines        4411     4479      +68     
==========================================
+ Hits         4169     4219      +50     
- Misses        242      260      +18
Impacted Files Coverage Δ
seaborn/categorical.py 96.69% <100%> (+0.01%) ⬆️
seaborn/basic.py 99.45% <100%> (+0.04%) ⬆️
seaborn/regression.py 97.01% <40%> (-0.96%) ⬇️
seaborn/axisgrid.py 94.72% <48.27%> (-1.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56743db...62fb1ee. Read the comment docs.

@mwaskom mwaskom merged commit ce90b66 into master Jul 3, 2018
@mwaskom mwaskom deleted the relplot branch July 3, 2018 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant