使用 plt 的一些记录
这里都是收集来的资料,以便自己查找
# 1 一张画布显示多张图片
figure()
figure(figsize=(3, 3))
suptitle('总标题', fontsize=10) #figure的总标题
subplot(121) #(行,列,个)
title('每块的小标题')
imshow(h_array)
subplot(122)
plt.title('Easy as 1,2,3')
imshow(temp)
savefig( "%d i_array.png"%(num) )#保存图片
hist(Cb_array.flatten(),256)#直方图
show()
# 2 自动收集文件名,判断类型,提取名字及扩展名
import os
file_path = "D:/test/test.py"
(filepath,tempfilename) = os.path.split(file_path)
(filename,extension) = os.path.splitext(tempfilename)
其中:
- filepath为文件的目录,即
D:/test
- filename为文件的名字,即
test
- extension为文件的扩展名,即
.py
Python 遍历文件夹中的指定类型文件(比较全面)
http://blog.sina.com.cn/s/blog_a322be3f01016lkb.html
https://www.cnblogs.com/zangyu/p/5764905.html
我的:
list_f = []
for filename in os.listdir(r"E:\\MyProject\\Picture\\mondrian_8_bit\\mondrian_8_bit\\ball"):
a,b = os.path.splitext(filename)
if b == '.tif':
list_f.append(a)
print list_f