pyplot.subplot 及 imshow绘图 去除坐标轴及调整子图间距
2017-07-21 23:03
295 查看
fnum = len(train_datasets) plt.figure("show pickle", figsize=(10,10)) j = 0 for set_filename in train_datasets: print('trying to read pickle: %s ' % set_filename) try: with open(set_filename, 'rb') as f: dataset=pickle.load(f) except Exception as e: print('Unable to open pckle file ', set_filename, ':', e) print ('%d images in total in file %s' % (len(dataset), set_filename)) for i in range(10):
plt.subplot( fnum, 10, 10*j + i + 1) plt.imshow(dataset[i], cmap='gray');
##去除子图的坐标轴, 对上一个画出的子图起作用 plt.axis('off')j += 1
##设定子图间距 , left < right, top > bottom, 数字表示窗口大小的比例(如下则子图间距为窗口大小的1%) plt.subplots_adjust(left=0.04, top= 0.96, right = 0.96, bottom = 0.04, wspace = 0.01, hspace = 0.01)
关于为什么要了left<right (否则会报错 ValueError: bottom cannot be >= top):
When using
subplots_adjust,
the values of
left,
right,
bottomand
topare
to be provided as fractions of the figure width and height. In additions, all values are measured from the left and bottom edges of the figure. This is why
rightand
topcan't
be lower than
leftand
right.
A typical set-up is: ----- 点击打开参考源
相关文章推荐
- 180302 python如何调整subplot的间距
- Matlab subplot 图像间距调整
- Python利用matplotlib.pyplot绘图时如何设置坐标轴刻度
- matplotlib调整子图间距,调整整体空白
- Matlab中怎么调整subplot中子图的间距
- Matlab绘图marker间距调整脚本
- geopandas简单绘图及横坐标调整
- matplotlib调整子图间距,调整整体空白的方法
- 去除inline-block元素间间距的N种方法
- ios 调整 label 的字体行间距
- 去除inline-block元素间间距的N种方法
- UILabel调整字间距
- 去除inline-block元素间间距的方法
- python matplotlib.subplot绘制子图
- Qt 2D绘图之Qt坐标系统深入
- 如何去除使用inline-block之后的间距(一)?
- 很好的网页坐标绘图工具Highcharts
- Echarts 如何调整 legend 和图表的间距
- matplotlib figure定义一张大的画布 axex/subplot是子图
- QT 2D绘图的坐标系统与图像