ach
ach

Reputation: 47

How to not display the pearson's coefficient on seaborn's jointplot?

I'm trying to generate a joint plot from the seaborn library, and I was wondering whether anyone knew how to not display the pearson's coefficient on the plot as it seems to be the default, as shown here:

enter image description here

The code that I'm using the generate the plot is shown below;

g = sns.jointplot(x=pdf['embedding 1'], y=pdf['embedding 2'], 
              data=pdf, kind="kde", color="m")
g.plot_joint(plt.scatter, c="w", s=0.1, marker="o")
g.ax_joint.collections[0].set_alpha(0)
plt.show()

EDIT: Updating to seaborn version 0.9.0 made it work (I was running version 0.8.1)

Upvotes: 3

Views: 5258

Answers (2)

msklc
msklc

Reputation: 604

I had also same problem with seaborn version 0.9.0 I couldn't understand the reason but I sold the problem with adding pearsonr score to the plot by;

import scipy.stats as stats
g.annotate(stats.pearsonr)
plt.show()

Upvotes: 0

Diziet Asahi
Diziet Asahi

Reputation: 40667

I'm not entirely sure whether your problem was fixed by upgrading to 0.9.0 as per your comment, but I also don't think the legend would magically disappear when doing the upgrade.

To remove the pearson's coefficient, add:

g.ax_joint.legend_.remove()

before plt.show()

Upvotes: 3

Related Questions