-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_ksnet.py
executable file
·49 lines (44 loc) · 1.88 KB
/
plot_ksnet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.io
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-d', '--double',dest='double',default = False,help='double means plot t1 and t2 as RG channel')
parser.add_option('-c', '--load', dest='load',
default=False, help='load file model')
(options, args) = parser.parse_args()
dic_compressed = np.load(options.load)
# dic_compressed = np.load("compressed_dic_final.npy")
#dic_compressed = B_tensor_cuda.detach().cpu().numpy()
fig = plt.figure(figsize=(10,8.3))
# x, y, z = data[0], data[1], data[2]
ax = plt.subplot(111, projection='3d') # 创建一个三维的绘图工程
# 将数据点分成三部分画,在颜色上有区分度
# ax.scatter(x[:10], y[:10], z[:10], c='y') # 绘制数据点
# ax.scatter(x[10:20], y[10:20], z[10:20], c='r')
# ax.scatter(x[30:40], y[30:40], z[30:40], c='g')
p = ax.scatter(dic_compressed[:,0], dic_compressed[:,1], dic_compressed[:,2], marker = '*',linewidths=0.3,cmap = "hot")
ax.set_xlim([-1, 1])
ax.set_zlim([-1,1])
ax.set_ylim([-1, 1])
# fig.colorbar(p)
ax.set_zlabel('Z') # 坐标轴
ax.set_ylabel('Y')
ax.set_xlabel('X')
# fig1 = plt.figure(figsize=(10,8.3))
# # x, y, z = data[0], data[1], data[2]
# ax1 = plt.subplot(111, projection='3d') # 创建一个三维的绘图工程
# # 将数据点分成三部分画,在颜色上有区分度
# # ax.scatter(x[:10], y[:10], z[:10], c='y') # 绘制数据点
# # ax.scatter(x[10:20], y[10:20], z[10:20], c='r')
# # ax.scatter(x[30:40], y[30:40], z[30:40], c='g')
# p1 = ax1.scatter(dic_compressed[:,0], dic_compressed[:,1], dic_compressed[:,2], c=t_color,marker = '*',linewidths=0.3,cmap = "hot")
# ax1.set_xlim([-1, 1])
# ax1.set_zlim([-1,1])
# ax1.set_ylim([-1, 1])
# # fig1.colorbar(p1)
# ax1.set_zlabel('Z') # 坐标轴
# ax1.set_ylabel('Y')
# ax1.set_xlabel('X')
plt.show()