matplotlib z-direction… here is a solution to the problem.
matplotlib z-direction
I can’t finish plotting in matplotlib. Here is the code:
arrays_k, arrays_v = splitbyrecordcount(ycsb[2])
checktype = [ "Update", "Read", "Verification" ]
fig = plt.figure()
ax = fig.add_subplot('111', projection='3d')
for z in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
xs = arrays_k[z]
ys = arrays_v[z]
c = colmap.spectral(z/10.,1)
ax.plot(xs, ys, zs=z, zdir='z', color=c)
It produces this:
I hope the time graph is what you expect: more of the screen “in the plane” than “vertically” to the screen as in the image above. I tried a lot of different ax.plot() partial combinations, but if I change it to:
ax.plot(xs, ys, zs=z, zdir='y', color=c)
I see:
Change it to:
ax.plot(xs, ys, zs=z, zdir='x', color=c)
… It doesn’t help either. It simply forms a thin strip in the z-direction of the origin.
Any ideas? Even if someone knows a way to rotate the entire graphic so that the drawing is within the plane of the screen, it’s better than nothing.
Solution
In the absence of data to check, I think the problem is in the order of the parameters of ax.plot
. Try this :
ax.plot(xs, z * np.ones(xs.shape), zs=ys, zdir='z', color=c)
Therefore, you want the “y” axis in the 2D drawing as the height, so zs=ys
.