Hi,
I'm trying to plot something like this example. I'd like to add two other distributions to the same plot. But I don't think I can since jointplot is a figure-level function. It would be nice to able to, though. Keep up the great work with Seaborn!
Cheers,
Caroline
Ah, you definitely can add stuff to plots made with figure-level functions, you just have to do so after calling them. In the case of jointplot, it returns an object of class JointGrid that exposes the three component axes at attributes called ax_joint, ax_marg_x, and ax_marg_y. So you can add you additional plots on those objects. Make sense?
Right. I can add a plot, but it doesn't generate all the bells and whistles that jointplot does. I want to get something like the figure 3 in this paper. I was going to worry about the contour aspect of the plot afterwards.
Thanks for the quick reply! I closed this by mistake. I'm sorry.
I think in your case I'd do something like this using the tips dataset as an example:
tips = sns.load_dataset("tips")
g = sns.JointGrid("total_bill", "tip", tips)
for day, day_tips in tips.groupby("day"):
sns.kdeplot(day_tips["total_bill"], ax=g.ax_marg_x, legend=False)
sns.kdeplot(day_tips["tip"], ax=g.ax_marg_y, vertical=True, legend=False)
g.ax_joint.plot(day_tips["total_bill"], day_tips["tip"], "o", ms=5)
Requires a little more work on your end than just using jointplot, but a lot less than building from scratch with pure matplotlib.
Perfect! It works great!!! I'll send you an e-mail with my plot. Thank you so much for the quick responses! I'm at a conference with Fernando Perez. He said he'll see you soon and I asked him to thank you in person. ;)
Most helpful comment
I think in your case I'd do something like this using the tips dataset as an example:
Requires a little more work on your end than just using
jointplot, but a lot less than building from scratch with pure matplotlib.