-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathutils.py
More file actions
42 lines (29 loc) · 1.08 KB
/
Copy pathutils.py
File metadata and controls
42 lines (29 loc) · 1.08 KB
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
import matplotlib.pyplot as plt
import os
import shutil
def clear_folder(path):
if os.path.exists(path):
shutil.rmtree(path)
os.mkdir(path)
def plotPCbatch(pcArray1, pcArray2, show = True, save = False, name=None, fig_count=9 , sizex = 12, sizey=3):
pc1 = pcArray1[0:fig_count]
pc2 = pcArray2[0:fig_count]
fig=plt.figure(figsize=(sizex, sizey))
for i in range(fig_count*2):
ax = fig.add_subplot(2,fig_count,i+1, projection='3d')
if(i<fig_count):
ax.scatter(pc1[i,:,0], pc1[i,:,2], pc1[i,:,1], c='b', marker='.', alpha=0.8, s=8)
else:
ax.scatter(pc2[i-fig_count,:,0], pc2[i-fig_count,:,2], pc2[i-fig_count,:,1], c='b', marker='.', alpha=0.8, s=8)
ax.set_xlim3d(0.25, 0.75)
ax.set_ylim3d(0.25, 0.75)
ax.set_zlim3d(0.25, 0.75)
plt.axis('off')
plt.subplots_adjust(wspace=0, hspace=0)
if(save):
fig.savefig(name + '.png')
plt.close(fig)
if(show):
plt.show()
else:
return fig