I have already asked a similar question here and have almost figured out the answer by myself.
The only thing that remains is the following:
I am using meshgrid
to create a 3D grid. When specifying the colors in color_map.set_array(colo)
I am using an array which has the same size as elements in the meshgrid
. But how does this array have to be ordered to yield the correct plot?
x=[7, 8, 9, 10, 11, 12]
y= [0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
z= [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
colo=np.random.normal(0, 1, 216)
X,Y,Z = np.meshgrid(x,y,z)
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(111, projection='3d')
color_map = cm.ScalarMappable(cmap=cm.Greens_r)
color_map.set_array(colo)
img = ax.scatter(X, Y, Z, marker='s',
s=200, color='green')
plt.colorbar(color_map)