用不同样式的颜色可视化图形中的数组

问题描述 投票:0回答:1

我想用颜色图可视化一个数组,因此我可以将许多数组相互比较,看看它们在哪里相似或不相似。一个示例数组是:

import numpy as np
import matplotlib.pyplot as plt

coef = np.array([7.84678e-06, -3.03161e-06, 4.1283e-06, -3.33764e-06, 8.18091e-07, 4.0515e-07, 5.03187e-06, 1.40076e-05, -0.240809, -0.0133863, 0.0479671, 0.0740471, 0.222519, 0.10136, 0.0594249, -0.103346])

plt.pcolor([coef,coef] , cmap = 'hsv' )
plt.show()

并获得剧情:

enter image description here

还有其他更好的方法来可视化数组吗?特别是如果我得到一个长度为1000或2000的较长数组,则排列不明确:

enter image description here

python numpy matplotlib
1个回答
0
投票
plt.hist2d(coef, coef)
plt.show()

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.