【问题标题】:remove white spaces in images subplot in python and save it [duplicate]删除python中图像子图中的空格并保存[重复]
【发布时间】:2018-07-01 22:41:15
【问题描述】:

我想使用以下代码在 python3 中创建频谱图的子图。 我的问题是我在地块和

之间有空格
import matplotlib
matplotlib.use('Agg')

import matplotlib.pyplot as plt    

j=0
plt.clf()

f, axarr= plt.subplots(4,5, gridspec_kw = {'wspace':0, 'hspace':0})
f.tight_layout()

for i, ax in enumerate(f.axes):
    j=j+1
    im = ax.imshow(syllable_1.transpose(), vmin=0, vmax=syllable_1.max(), 
    cmap='pink_r')

    plt.xticks([], [])

    #ax[j].autoscale_view('tight')

    #ax.set_xticklabels([])

    #ax.set_yticklabels([])


#plt.subplots_adjust(left=0.1, right=0.85, top=0.85, bottom=0.1)
plt.subplots_adjust(wspace=0, hspace=0)

plt.savefig("myfig9.png", bbox_inches='tight')

结果如下:

你能建议我一些解决方案吗?

提前致谢

【问题讨论】:

    标签: matplotlib python-3.5 subplot imshow


    【解决方案1】:

    为了让你知道,我将aspect='auto' 添加到我的情节代码中,它就解决了。我使用了以下link。看来我没有使用好的关键字进行搜索。谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-14
      • 1970-01-01
      • 2012-04-23
      • 1970-01-01
      • 2012-08-03
      • 2020-12-25
      • 2011-12-08
      相关资源
      最近更新 更多