我找到了答案:
a = sns.jointplot(x=var_x, y=var_y, data=my_df)
a.ax_joint.plot([0],[0],'o',ms=60 , mec='r', mfc='none',)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="white", color_codes=True)
tips = sns.load_dataset("tips")
a = sns.jointplot(x="total_bill", y="tip", data=tips)
a.ax_joint.plot([15],[3],'o',ms=60 , mec='r', mfc='none',)
有一种肮脏的方法:根据等式生成圆,然后绘制圆。我敢肯定还有更复杂的解决方案,但我还不能弄清楚。通过修改sns.JointGrid
的数据。
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
sns.set(style="ticks")
R = 8 # radius
d = np.linspace(0,2*np.pi, 400) # some data to draw circle
def circle(d, r):
# x and y from the equation of a circle
return r*np.cos(d), r*np.sin(d)
rs = np.random.RandomState(11)
x = rs.gamma(2, size=1000)
y = -.5 * x + rs.normal(size=1000)
#graph your data
graph = sns.jointplot(x, y, kind="hex", color="#4CB391")
# creating the circle
a, b = circle(d, R)
#graphing it
graph.x = a
graph.y = b
graph.plot_joint(plt.plot)
plt.show()