将数据添加到 seaborn 联合图 [英] Add data to a seaborn jointplot
本文介绍了将数据添加到 seaborn 联合图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下seaborn方法(返回和波动率是浮点数列表)得到了一个不错的KDE联合图:
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)
如何在此联合图上叠加特定点?例如,如果我想在位置(0.2,0.2)的KDE聊天中叠加一个红点
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)
推荐答案
您可以像这样从 jointplot
在关节轴上绘图:
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
这篇关于将数据添加到 seaborn 联合图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文