-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot3d.py
More file actions
64 lines (48 loc) · 1.61 KB
/
plot3d.py
File metadata and controls
64 lines (48 loc) · 1.61 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import matplotlib.pyplot as plt
import numpy as np
class Plot3D(object):
def __init__(self, x, y, z):
self.x = x # 1d array
self.y = y # 1d array
self.z = z # 2d array
fig = plt.figure(figsize=(8, 6))
self.ax = fig.add_subplot(111, projection='3d')
def surf_plot(self):
self.ax.plot_surface(
*np.meshgrid(self.x, self.y), self.z,
shade=True, cmap='jet', rstride=1, cstride=1
)
self.ax.view_init(azim=-30)
self.ax.set_xlim(0, 100)
self.ax.set_xticks([0, 50, 100])
self.ax.set_xticklabels(['100', '50', '0'])
self.ax.set_ylim(0, 90)
self.ax.set_yticks([0, 30, 60, 90])
self.ax.set_zlim(0, 3)
self.ax.set_zticks([0, 1, 2, 3])
'''
self.ax.set_xlabel(
r'$\it{dusp}$'+' mRNA\nknockdown efficiency (%)', labelpad=10
)
self.ax.set_ylabel('Time (min)', labelpad=7.5)
self.ax.set_zlabel(
r'$\it{c}$'+'-'+r'$\it{fos}$'+' mRNA\nexpression (%)', labelpad=5
)
'''
def main():
'''dusp mRNA knockdown efficiency'''
x = (1-np.arange(101)/100)*100
'''Time (min)'''
y = np.arange(5401) / 60
'''c-fos mRNA expression'''
z = np.load('data/z_cFosmRNA.npy')[0].T
# z = np.load('data/z_cFosmRNA.npy')[1].T
plt.rcParams['font.size'] = 20
plt.rcParams['font.family'] = 'Arial'
plt.rcParams['mathtext.fontset'] = 'custom'
plt.rcParams['mathtext.it'] = 'Arial:italic'
plt3d = Plot3D(x, y, z)
plt3d.surf_plot()
plt.show()
if __name__ == '__main__':
main()