The following is a description of this function:
def jointplot(x, y, data=None, kind="scatter", stat_func=stats.pearsonr,
color=None, size=6, ratio=5, space=.2,
dropna=True, xlim=None, ylim=None,
joint_kws=None, marginal_kws=None, annot_kws=None, **kwargs)
and the following is the description of the last few oprional parameters:
{joint, marginal, annot}_kws : dicts, optional
Additional keyword arguments for the plot components.
kwargs : key, value pairings
Additional keyword arguments are passed to the function used to
draw the plot on the joint Axes, superseding items in the
``joint_kws`` dictionary.
The document mentions that I can pass in a dictionary like 'joint_kws' or 'marginal_kws' to control the plot, but where can you find the definition and usage of these dictionaries? I did not see it in the official documentation. Who can help me? thx!
As the documentation says, these dictionaries are passed to the plotting function used to plot either on the joint axes, or the marginal axes. The actual keys that are to be passed therefore depend on the kind of plot your doing.
for example, if you are doing jointplot(..., kind="kde", ...)
then seaborn would use sns.kdeplot()
to do the plotting on the joint axes, and therefore any argument that can be passed to that function can be provided in joint_kws=
. Looking at the definition of sns.kdeplot()
, I see that I can pass an argument shade=
("If True, shade in the area under the KDE curve (or draw with filled contours when data is bivariate)."), therefore, I can pass that argument in the joint_kws
dictionary:
iris = sns.load_dataset("iris")
g = sns.jointplot("sepal_width", "petal_length", data=iris,kind="kde",
space=0, color="g", joint_kws=dict(shade=False))
If I were to run sns.jointplot(..., kind='scatter',...)
then seaborn would use plt.scatter()
to draw the actual plot. I can look at the definition for pyplot.scatter()
and see which keys I can use in my dictionary:
tips = sns.load_dataset("tips")
g = sns.jointplot(x="total_bill", y="tip", data=tips, kind='scatter', joint_kws=dict(marker='D', s=50))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With