can jointplot visualize different classes?
See original GitHub issueIs it possible to have different color for different classes in joinplot? Something like
df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))
df['category'] = np.random.randint(0, high = 5, size = 100)
sns.jointplot('B','A', data = df, color='category')
where a different color is used for each different value in the category column. Even better, would be possible to have a color for each value after a function is mapped to the column? In my example, assume I would like to have a color for odd values, and another one for even values of the column, i.e.
sns.jointplot('B','A', data = df, color='category', map = (lambda x: x % 2))
Issue Analytics
- State:
- Created 9 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
seaborn.jointplot — seaborn 0.12.1 documentation - PyData |
Draw a plot of two variables with bivariate and univariate graphs. This function provides a convenient interface to the JointGrid class, with several...
Read more >Joint Plot - Ajay Tech
The jointplot creates a scatterplot with two marginal histograms by default. If required different plots can be displayed on the main plot by ......
Read more >How to make a jointplot in Seaborn with multiple groups or ...
To create the scatter plot, two calls to sns.scatter() will do: import matplotlib.pyplot as plt import pandas as pd import seaborn as sns ......
Read more >Data Visualization with Python and Seaborn — Part 5: Scatter ...
Joint plot is a figure-level function so it can't coexist in a figure with other plots. But we do have our ; kde...
Read more >Python - seaborn.jointplot() method - GeeksforGeeks
Seaborn is a Python data visualization library based on matplotlib. ... Syntax: seaborn.jointplot(x, y, data=None, kind='scatter', ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
xref #2210
@mwaskom would you consider a PR to add support for
hue
injointplot
and/orJointGrid
, or at least some changes toJointGrid.plot_{joint,marginals}
to support some of the categorical plotters? (As of now,joint_grid.plot_marginals(sns.boxplot, hue=whatever)
raises an error about an unexpected keyword argument used to set the orientation. Seems like an easy fix and I’d be happy to work on this.)It seems like there’s a lot of demand for increased support for visualizing the distributions of categorical data (https://github.com/mwaskom/seaborn/issues/861, https://github.com/mwaskom/seaborn/issues/1486, this question). @ruxi’s gist is a nice solution, but it would be great to have this behaviour or something similar directly in
jointplot
/JointGrid
. A potential drawback of folding this behaviour directly intoJointGrid
is that the joint axis might not look very good if we use certain styles (eg hex), but I think this could be solved by raising an error.Let me know if this fits with how you’d like to see
jointplot
andJointGrid
used and I can work on a PR.