首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
首页标签matplotlib

#matplotlib

关于matplotlib转化矩阵为图像时的尺寸问题?

如何自定义cartopy通过contourf作图时的colorbar?

Python画图问题,总出现警告,怎么解决呢?

如何使用matplotlib中的dataframe.art()函数?

设置矩形的宽度: In [208]: df = pd.DataFrame(np.random.random((6, 5)) * 10, index=list('abcdef'), columns=list('ABCDE')) In [209]: df Out[209]: A B C D E a 4.2 6.7 1.0 7.1 1.4 b 1.3 9.5 5.1 7.3 5.6 c 8.9 5.0 5.0 6.7 3.8 d 5.5 0.5 2.4 8.4 6.4 e 0.3 1.4 4.8 1.7 9.3 f 3.3 0.2 6.9 8.0 6.1 In [210]: ax = df.plot(kind='bar', stacked=True, align='center') In [211]: for container in ax.containers: plt.setp(container, width=1) .....: In [212]: x0, x1 = ax.get_xlim() In [213]: ax.set_xlim(x0 -0.5, x1 + 0.25) Out[213]: (-0.5, 6.5) In [214]: plt.tight_layout() [Z8nql.png] ... 展开详请

如何保存绘图到图像文件中,并且可以不是使用Matplotlib来显示它?

嗨喽你好摩羯座

解决方案是:

代码语言:txt
复制
pylab.savefig('foo.png')
领券