Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add data to a seaborn jointplot

I've got a nice KDE joint plot using the following seaborn method (where return and volatility are lists of floats):

data=pd.DataFrame({"return":returns,"volatility":volatilities,})
a=sns.jointplot(x="volatility", y="return", data=data, size=10)

How can I overlay specific dots on this joint plot? For example, if I'd like a red dot superimposed on the KDE chat at location (0.2,0.2)

like image 794
Alexis Eggermont Avatar asked Nov 05 '15 11:11

Alexis Eggermont


People also ask

What is the advantage of using Jointplot to plot data?

Draw a plot of two variables with bivariate and univariate graphs. This function provides a convenient interface to the JointGrid class, with several canned plot kinds. This is intended to be a fairly lightweight wrapper; if you need more flexibility, you should use JointGrid directly.

What is a Jointplot in Seaborn?

A jointplot is seaborn's method of displaying a bivariate relationship at the same time as a univariate profile. Essentially combining a scatter plot with a histogram (without KDE).

How do you increase the size of a Pairplot?

Changing the Seaborn Pairplot Figure Size We can also use the aspect keyword argument to control the width. By default this is set to 1, but if we set it to 2, it means we are setting the width to twice the size of the height. Seaborn pairplot after changing the figure size using height and aspect.


1 Answers

You can plot on the joint axis from the jointplot like this:

a=sns.jointplot(x="volatility", y="return", data=data, size=10)
a.ax_joint.plot([0.2],[0.2],'ro')

As an aside, you can also access the x and y margin subplots with

a.ax_marg_x
a.ax_marg_y
like image 123
tmdavison Avatar answered Nov 04 '22 11:11

tmdavison