ahmed
ahmed

Reputation: 11

how could I create a 4 dimensional plot in python?

i would like to plot 4 dimensional plot in python along x y z and 4th one is colour plot in python ....my dta is like

x=np.array([
-0.256000000000000
-0.173400000000001
-0.108800000000002
-0.0578000000000003
-0.0194000000000010
.......])

y=np.array([0.120020800000000
0.117440400000000
0.118825300000000
0.121856900000000
0.119601200000000
.....])

z=np.array([0.256010000000000
0.316988000000000
0.412030000000000
0.516346000000000
0.626786000000000
.....])

c=np.array([35.4849000000000
35.8240000000000
35.8697000000000
35.3643000000000
34.6013000000000.......])

Each vector has 76 values. How could I get a 4d plot in python with this data?

Upvotes: 1

Views: 335

Answers (1)

jdsurya
jdsurya

Reputation: 1376

As you noted, it will actually be a 3d plot with color acting as the fourth one. One way is to use matplotlib to plot a 3d diagram with color option as shown below

import matplotlib.pyplot as plt

fig = plt.figure()
ax = plt.axes(projection='3d')
ax.scatter(x, y, z, c=c)

ax.set_title('4d Plot')
plt.show()

Output:

enter image description here

Upvotes: 1

Related Questions