如何解决如何在seaborn Pairplot中设置x轴大小
我正在使用 Seaborn 绘制配对图。问题在于,对于某些变量,x 轴的大小很小,并且数据点彼此非常接近,如下所示(图的第一行):
如您所见,第二行的绘图很好。
这是我使用的代码:
import math
import matplotlib.pyplot as plt
import seaborn as sns
y_name = 'y'
features = data.iloc[:,:-1]
features_names = features.columns
plot_size=7
num_plots_x=10 # No. of plots in every row
num_plots_y = math.ceil(len(features_names)/num_plots_x) # No. of plots in y direction
fig = plt.figure(figsize=(plot_size*num_plots_y,plot_size*num_plots_x),facecolor='white')
axes = [fig.add_subplot(num_plots_y,1,i+1) for i in range(num_plots_y)]
for i,ax in enumerate(axes):
start_index = i * num_plots_x
end_index = (i+1) * num_plots_x
if end_index > len(features_names): end_index = len(features_names)
sns.pairplot(x_vars=features_names[start_index:end_index],y_vars=y_name,data = data)
plt.savefig('figure.png')
有什么方法可以设置 x 轴的大小或比例吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。