python - 在 PyPlot 子图中设置 Seaborn 中的图形大小
问题描述
我有一段代码可以在一个图像中绘制多个散点图 -
columns_for_clusters = set(column_types_and_names['object']) - set(ignore_columns_in_model)
columns_for_clusters = list(columns_for_clusters)
fig,ax1 = plt.subplots(math.ceil((len(column_types_and_names["int64"]) - 2)/3),3)
plt.figure(figsize=(16, 6))
x = 0
for index in range(0,len(column_types_and_names["int64"])):
if(column_types_and_names["int64"][index] != 'SalePrice' and column_types_and_names["int64"][index] != 'Id'):
#train.plot(kind="scatter", x="SalePrice", y=column_types_and_names["int64"][index], ax=ax1[int(x / 3)][x % 3],figsize = (30,40), s = 1)
g =sns.scatterplot(x="SalePrice", y=column_types_and_names["int64"][index],
hue=columns_for_clusters[0],
data=train, ax = ax1[int(x / 3)][x % 3]);
x = x + 1
plt.show()
地块的大小非常小。我该如何解决?
我必须绘制 12*3 的情节该情节在 Pandas Plot 中有效。有没有办法在 Pandas 散点图中显示带有分类颜色的散点图?
解决方案
这有效 -
columns_for_clusters = set(column_types_and_names['object']) - set(ignore_columns_in_model)
columns_for_clusters = list(columns_for_clusters)
fig,ax1 = plt.subplots(math.ceil((len(column_types_and_names["int64"]) - 2)/3),3)
plt.figure(figsize=(30, 40))
x = 0
for index in range(0,len(column_types_and_names["int64"])):
if(column_types_and_names["int64"][index] != 'SalePrice' and column_types_and_names["int64"][index] != 'Id'):
#train.plot(kind="scatter", x="SalePrice", y=column_types_and_names["int64"][index], ax=ax1[int(x / 3)][x % 3],figsize = (30,40), s = 1)
sns.scatterplot(x="SalePrice", y=column_types_and_names["int64"][index],
hue=columns_for_clusters[0],
data=train, ax = ax1[int(x / 3)][x % 3]);
x = x + 1
plt.show()
删除g=
推荐阅读
- datetime - HubL / Twig:比较两个unix时间戳
- javascript - 如何触发 GeckoFx 中的所有相关事件?
- mongodb - 服务器处理程序中的多个 DB
- php - MAMP .htaccess LimitExcept doesn't block GET request
- angular - 同时显示所有工具提示 - MatTooltip Angular
- c# - 为什么我的 Teams 机器人可以在一对一聊天中工作,但不能在群组中工作?
- c++ - 前向申报可以自动化吗?
- javascript - XPages View onClick 模态对话框显示
- python - 从文件末尾删除第一个逗号
- python - 密码检查器尝试 2