Week 11: Joint Distribution of two variables

Hello, I was drawing joint kde plot of 2 random variables. I am able to draw it but I couldn’t get any shades on contours in that plot. The code is as follows:

```

x=np.random.normal(size=1000)

y=np.random.normal(size=1000)

df=pd.DataFrame({‘x’:x,‘y’:y})

sns.jointplot(‘x’,‘y’,data=df,kind=‘kde’)

```

How will I get the shades?

sns.jointplot(‘x’,‘y’,data=df,kind=‘kde’, shade=True)

Thank you… I again have a question : If I read the documentation of sns.jointplot, there is no argument as shade in it. When we specify shade=True then we get shades in contour. But why don’t we get the error?

The last argument of these functions is usually **kwargs. This means that the function can take as many keyword arguments. The sns.jointplot has a predefined dictionary of joint_kws that is used to draw the plot on the joint Axes. This has all the parameters of plotting a graph and when we pass our own argument in this function, these keywords are superseded with our arguments in the joint_kws and we get our desired plot.

Some reference for better understanding:

1 Like