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.

can jointplot visualize different classes?

See original GitHub issue

Is 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:closed
  • Created 9 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mwaskomcommented, Aug 21, 2020

xref #2210

0reactions
efharkincommented, Aug 4, 2020

@mwaskom would you consider a PR to add support for hue in jointplot and/or JointGrid, or at least some changes to JointGrid.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 into JointGrid 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 and JointGrid used and I can work on a PR.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

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