0

I would like to use kernel density estimate of seaborn.

First I would like to add a colorbor for the main plot.

Second I would like to add horizontal line to the joint probability distribution to show the 68%, 98% confidence levels and another line which shows the true value

Third I also would like to remove the legend in the plot, considering the following example:

import numpy as np
import pandas as pd
import seaborn as sns

sns.set_context("paper")
# Generate a random correlated bivariate dataset
rs = np.random.RandomState(5)
mean = [0, 0]
cov = [(1, .5), (.5, 1)]
x1, x2 = rs.multivariate_normal(mean, cov, 500).T
x1 = pd.Series(x1, name="$X_1$")
x2 = pd.Series(x2, name="$X_2$")

# Show the joint distribution using kernel density estimation
g = sns.jointplot(x1, x2, kind="kde", size=7, space=0, color="r")

How should I do it?

Dalek
  • 4,168
  • 11
  • 48
  • 100

2 Answers2

1
  1. Not easily possible (although the density values are not particularly interpretable anyway).

  2. These are matplotlib objects, you can add any additional plot elements you want to them.

  3. stat_func=None, as is shown here.

mwaskom
  • 46,693
  • 16
  • 125
  • 127
0

AFAIK you can't do any of those per doc.

  1. I would like to add a colorbor for the main plot.

That's no an option with jointplot. Colorbars are only available with heatmap, clustermap, and interactplot

  1. I would like to add horizontal line to the joint probability distribution to show the 68%, 98% confidence levels and another line which shows the true value

Not an option as well, the closest you can come to that is overlay two graphs

  1. I also would like to remove the legend in the plot

I'm assuming you're talking about the pearsonr and p values. Those aren't legends and no documentation to show a way to remove them.

Community
  • 1
  • 1
Leb
  • 15,483
  • 10
  • 56
  • 75
  • I am sure there should be a way to access the axes of these plots and manipulate them accordingly but I don't know how?! – Dalek Nov 03 '15 at 03:45
  • There is a way if you change the underlying code, but other than that there isn't much room for customization with `seaborn`. – Leb Nov 03 '15 at 03:48
  • I am looking for a way to change the underlying code as you said. – Dalek Nov 03 '15 at 03:52