如何在Seaborn中更改重新绘制的地块大小?
问题内容:
与fig.set_size_inches(18.5, 10.5)
matplotlib相似。
问题答案:
您可以先声明fig, ax
对plt.subplots()
,然后在该图上设置适当的大小,然后要求sns.regplot
在该图上进行绘制ax
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# some artificial data
data = np.random.multivariate_normal([0,0], [[1,-0.5],[-0.5,1]], size=100)
# plot
sns.set_style('ticks')
fig, ax = plt.subplots()
fig.set_size_inches(18.5, 10.5)
sns.regplot(data[:,0], data[:,1], ax=ax)
sns.despine()