-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmatplotlib_3.py
More file actions
51 lines (43 loc) · 986 Bytes
/
Copy pathmatplotlib_3.py
File metadata and controls
51 lines (43 loc) · 986 Bytes
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
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import numpy as np
# 3D Charts
#
# fig = plt.figure()
#
# chart = fig.add_subplot(1, 1, 1, projection="3d")
# x = np.random.randn(100)
# y = np.random.randn(100)
# z = np.random.randn(100)
#
# plt.plot(x, y, z, linestyle="", marker="s")
# plt.show()
# 3D Scatter Plot
#
# fig = plt.figure()
#
# chart = fig.add_subplot(1, 1, 1, projection="3d")
# x = np.random.randn(100)
# y = np.random.randn(100)
# z = np.random.randn(100)
#
# size = 100 * np.random.randn(100)
# colors = np.random.rand(100)
#
# chart.scatter(x, y, z, s=size, c=colors, marker="^")
#
# plt.show()
# 3D Bar Charts
fig = plt.figure()
chart = fig.add_subplot(1, 1, 1, projection="3d")
x = [1, 2, 3, 4, 5]
y = [3, 6, 2, 8, 4]
z = [0, 0, 0, 0, 0]
dx = np.ones(5)
dy = np.ones(5)
dz = [1, 8, 3, 2, 5]
chart.bar3d(x, y, z, dx, dy, dz, color="red")
chart.set_xlabel("X Label")
chart.set_ylabel("Y Label")
chart.set_zlabel("Z Label")
plt.show()