[英]How do I change the plot size of a regplot in Seaborn?
与matplotlib的fig.set_size_inches(18.5, 10.5)
类似的东西。
You can declare fig, ax
pair via plt.subplots()
first, then set proper size on that figure, and ask sns.regplot
to plot on that ax
您可以先通过plt.subplots()
声明fig, ax
对,然后在该图上设置适当的大小,并让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()
Or a little bit shorter: 或者更短一些:
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')
g = sns.regplot(data[:,0], data[:,1])
g.figure.set_size_inches(18.5, 10.5)
sns.despine()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.