小编new*_*ewb的帖子

在python中绘制矩阵的内容(使用matplotlib)

嗨我需要绘制矩阵的内容,其中每行代表不同的特征,每列是不同的时间点.换句话说,我希望随着时间的推移看到功能的变化,并且我已经以矩阵的形式堆叠了每个特征.C是矩阵

A=C.tolist() #convert matrix to list.
R=[]
for i in xrange(len(A[0])):
    R+=[[i]*len(A[i])]    
for j in xrange(len(A[0])):
    S=[]
    S=C[0:len(C)][j]
    pylab.plot(R[j],S,'r*')
pylab.show()
Run Code Online (Sandbox Code Playgroud)

这是对的/有更有效的方法吗?谢谢!

python matplotlib

3
推荐指数
2
解决办法
2万
查看次数

将图像实例(文件)转换为数组(python)

我有一个图像序列,我试图在特定的帧上运行脚本.我需要切换到这个框架并将其转换为数组.但是,我无法将框架作为实例<TiffImagePlugin.TiffImageFile image mode=I;16 size=512x512 at 0x104A0C998>.如何将此实例转换为数组?我已经使用过numpy.array但它不起作用.谢谢!

prot=Image.open("F23BN.tif")
for frame in ImageSequence.Iterator(dna):
    if frame==16:
        frame.convert('L')
        print frame.mode, frame.format #I checked the format and it is still in the Instance format
Run Code Online (Sandbox Code Playgroud)

python tiff python-imaging-library

0
推荐指数
1
解决办法
7820
查看次数

标签 统计

python ×2

matplotlib ×1

python-imaging-library ×1

tiff ×1