I seem to have got stuck at a relatively simple problem but couldn't fix it after searching for last hour and after lot of experimenting.
I have two numpy arrays x
and y
and I am using seaborn's jointplot to plot them:
sns.jointplot(x, y)
Now I want to label the xaxis and yaxis as "X-axis label" and "Y-axis label" respectively. If I use plt.xlabel
, the labels goes to the marginal distribution. How can I make them appear on the joint axes?
Alternatively, you can specify the axes labels in a pandas
DataFrame
in the call tojointplot
.sns.jointplot
returns a JointGrid object, which gives you access to the matplotlib axes and you can then manipulate from there.(The problem with your attempt is that functions such as
plt.xlabel("text")
operate on the current axis, which is not the central one insns.jointplot
; but the object-oriented interface is more specific as to what it will operate on).