在对高维数据进行显示时,经常会出现各种问题,其实无外乎维度的掌握不好,
这里以二维数据为例,看看显示的区别。
我们首先创建一个array。
a=np.array([1,2,3,4,5])
b=np.array([a,a+10])
b
输出结果:
array([[ 1, 2, 3, 4, 5], [11, 12, 13, 14, 15]])绘制当前的数组的图像:
plt.plot(b,'o')
注意到,此时数组的维度为2×5.反映到图形上,结果为:
--------------------------
转置当前数组:
c=b.transpose()
c
输出为:
array([[ 1, 11], [ 2, 12], [ 3, 13], [ 4, 14], [ 5, 15]])绘制当前图形为:
plt.plot(c,'o')
===============================
输出第一维度:
-----------------
==========================