Python seaborn将xlim和ylim设置为jointplot,并摆脱了上方和右侧的分布信息

时间:2019-01-08 16:26:56

标签: python seaborn

你好,我是Python和Seaborn的新手。我只想为Seaborn关节图设置x限制和y限制。此外,我想在主图上方和右侧绘制此图,而没有分布信息。我怎样才能做到这一点?我正在尝试这样的事情:

import numpy as np 
import matplotlib.pyplot as plt from
matplotlib.ticker import NullFormatter 
import seaborn as sns
sns.set(style="ticks")


xData = np.random.rand(100,1)*5 
yData = np.random.rand(100,1)*10


xlim = [-15 15] 
ylim = [-20 20]

g = sns.jointplot(xData, yData, kind="hex", color="b", xlim, ylim)

2 个答案:

答案 0 :(得分:2)

xlimylim应该是元组。因此您的代码应为:

import numpy as np 
import matplotlib.pyplot as plt from
matplotlib.ticker import NullFormatter 
import seaborn as sns
sns.set(style="ticks")

xData = np.random.rand(100,1)*5 
yData = np.random.rand(100,1)*10

g = sns.jointplot(xData, yData, kind="hex", color="b", xlim = (-15,15), ylim = (-20,20))

答案 1 :(得分:0)

jointplot的{​​{1}}的联合轴是matplotlib kind="hex"图。因此,您只需致电hexbin

plt.hexbin(xData, yData)

enter image description here