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 scatterplot function #1436

Merged
merged 17 commits into from May 29, 2018
Merged

Add scatterplot function #1436

merged 17 commits into from May 29, 2018

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented May 20, 2018

This PR adds a scatterplot function that can set the color, size, and marker of the points based on semantic variables. Simple obvious example:

sns.scatterplot(
    x="total_bill", y="tip",
    hue="sex", style="smoker", size="size",
    data=tips,
)

image

More examples to come.

Possible functionality to be added in future development:

  • Jittering
  • Automatic point opacity for large datasets
  • Aggregation and estimation similar to lineplot

Ultimately, this should also replace the underlying scatter plotter in regplot (and therefore lmplot), and perhaps more pressingly, should be used by default in pairplot and jointplot.

In principle the API here will work fine in FacetGrid but, similar to the case with the categorical plots, the ordering and limits for the various semantic variables will need to be explicitly defined so it can be shared across the facets. There should be a higher-level function similar to factorplot to draw these plots onto a FacetGrid. It will need a name. One would be facetplot but that is very easily confused with factorplot.

The presence of this function will make it awkward that size/style semantics cannot be used in the categorical scatterplot functions (stripplot/swarmplot), but adding them would probably be too disruptive.

Closes #315

To Do:

  • Handle to-be-implemented functionality
  • Tests
  • API documentation
  • Gallery examples

@codecov
Copy link

codecov bot commented May 20, 2018

Codecov Report

Merging #1436 into master will increase coverage by 0.15%.
The diff coverage is 98.7%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1436      +/-   ##
==========================================
+ Coverage   94.17%   94.32%   +0.15%     
==========================================
  Files          15       15              
  Lines        4240     4300      +60     
==========================================
+ Hits         3993     4056      +63     
+ Misses        247      244       -3
Impacted Files Coverage Δ
seaborn/basic.py 98.71% <98.7%> (+0.92%) ⬆️

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 38c9b3e...abb0885. Read the comment docs.

@mwaskom mwaskom changed the title WIP: Add scatterplot function Add scatterplot function May 29, 2018
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.

None yet

1 participant