python print 字体大小怎么调_Matplotlib-打印大小,如何调整大小?

本文介绍了一种使用Python绘制图表的方法,并提出了在生成的图表中去除多余空白的具体需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我正在尝试从我创建的绘图中删除空白,请参见下面的照片:

YPaeJ.png

可以看到,右边和底部都有一个大白点,怎么解决?,请按我的脚本执行:fig = plt.figure(figsize=(7,7))

ax1 = plt.subplot2grid((4,3), (0,0),)

ax2 = plt.subplot2grid((4,3), (1,0),)

ax3 = plt.subplot2grid((4,3), (0,1),)

ax4 = plt.subplot2grid((4,3), (1,1),)

data = self.dframe[i]

tes = print_data(data, self.issues, self.color, self.type_user)

tes.print_top(data=data, top=10, ax=ax1, typegraph="hbar", problem=self.issues[i], tone=self.color[i])

tes.print_top(data=data, top=10, ax=ax2, typegraph="prod_bar", problem=self.issues[i], tone=self.color[i])

tes.print_top(data=data, top=10, ax=ax3, typegraph="reg_hbar", problem=self.issues[i], tone=self.color[i])

tes.print_top(data=data, top=10, ax=ax4, typegraph=self.type_user, problem=self.issues[i], tone=self.color[i])

problem = self.issues[i]

plt.tight_layout()

name = problem + str('.PNG')

plt.close(fig)

fig.savefig(name)

任何帮助都将不胜感激

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值