Reputation: 16478
I have points in 4 dimensions (lets call them, v,w,y,z) , which I would like to visualize.
My plan is to have two squares, (v x w
, y x z
), next to each other and then just plot each point twice.
Given two points ([1, 1, 1, 3], [2, 2, 2, 2]
) I envision something like this:
Given a small set of points, I could use different colors to show which points on the left correspond to the right. With a large set of points, that would be futile. But perhaps heat maps would then be the best to visualize it?
Or is there some alternative established way to visualize data of higher dimensions within python/matplotlib?
Here's some sample data:
>>> resultsArray[:,:4]
array([[ 0. , 0. , 0. , 0. ],
[ 0.00495236, 0.03919034, 0.00495287, 0.03919042],
[ 0.00240293, 0.02667374, 0.00220419, 0.02693434],
[ 0.0011231 , 0.0191784 , 0.00104353, 0.01928256],
[ 0.00547274, 0.04187615, 0.00657255, 0.04043363],
[ 0.00291993, 0.0286196 , 0.00292006, 0.02861962],
[ 0.00128136, 0.01975574, 0.00121107, 0.01984781],
[ 0.00591335, 0.04531384, 0.00873814, 0.04160714],
[ 0.00345499, 0.0310103 , 0.00396032, 0.03034784],
[ 0.00149387, 0.02056065, 0.0014939 , 0.02056065],
[ 0.00274306, 0.02667374, 0.00220419, 0.02659422],
[ 0.00123893, 0.01948363, 0.00108284, 0.01952189],
[ 0.00162006, 0.02379926, 0.00143157, 0.02389168],
[ 0.00347023, 0.0286196 , 0.00292006, 0.02806932]])
Upvotes: 2
Views: 10012
Reputation: 6253
What about a 3-D scatter plot, which actually comes out to be 4-dimensional when the color scale is included?
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
sp = ax.scatter(data[:,0],data[:,1],data[:,2], s=20, c=data[:,3])
plt.colorbar(sp)
You can customize the color scale and projection orientation as you like.
Upvotes: 5