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 hue_kws and markers to axis grids #323

Merged
merged 4 commits into from Oct 5, 2014
Merged

Add hue_kws and markers to axis grids #323

merged 4 commits into from Oct 5, 2014

Conversation

@mwaskom
Copy link
Owner

mwaskom commented Oct 5, 2014

This lets the user map the hue variable with arbitrary additional plot
aesthetics in FacetGrid/PairPlot, and it provides an easy interface to map the
scatterplot marker when using lmplot/pairplot.

sns.lmplot("total_bill", "tip", tips, hue="smoker", markers=["x", "o"], scatter_kws={"s": 50})

markers

g = sns.FacetGrid(attention, col="subject", col_wrap=5, hue="attention", 
                             hue_kws={"marker": ["s", "D"], "linestyle": ["-", "--"],},
                             aspect=.75)
g.map(plt.plot, "solutions", "score", ms=10, lw=3)
g.set(xlim=(.5, 3.5), xticks=[1, 2, 3], ylim=[0, 10])

facetgrid

sns.pairplot(iris, "species", markers=["o", "D", "s"], size=2)

pairgrid

This also has a small enhancement to change the marker params depending on the
kind of marker so that line-based glyphs are not invisible (which would
otherwise be the case with the default seaborn rc Params). This is only in lmplot, pending the introduction of sns.scatterplot.

Closes #310

This lets the user map the hue variable with arbitrary additional plot
aesthetics in FacetGrid, and it provides an easy interface to map the
scatterplot marker when using lmplot.

This also has a small enhancement to change the marker params depending on the
kind of marker so that line-based glyphs are not invisible (which would
otherwise be the case with the default seaborn rc Params)
@mwaskom mwaskom changed the title Add hue_kws to FacetGrid and markers to lmplot Add hue_kws and markers to axis grids Oct 5, 2014
@mwaskom mwaskom force-pushed the lmplot_markerstyle branch from 1c2e043 to 568d986 Oct 5, 2014
mwaskom added a commit that referenced this pull request Oct 5, 2014
Add hue_kws and markers to axis grids
@mwaskom mwaskom merged commit 9cb1263 into master Oct 5, 2014
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
@shoyer
Copy link
Contributor

shoyer commented Oct 5, 2014

Looks great!

This should let you do custom linestyles, too, yes? For example, if I wanted the second set of lines in the second example to be dashed, I could write something like hue_kws={'linestyle': ['-', '--']}?

@mwaskom
Copy link
Owner Author

mwaskom commented Oct 5, 2014

Yep! I just edited the example plot to show that. With the FacetGrid interface any kwarg for the function you want to map can be in the hue_kws.

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

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.