Why do all points get the same value? I would like colour to vary with energy.
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
from numpy import *
x = linspace(0.2, 2, 11)
y = linspace(0.1, 1, 11)
alpha, beta = meshgrid(x,y)
energy = matrix(loadtxt('energyPlotfileN6.txt'))
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_surface(alpha, beta, energy, cmap='summer', vmin=energy.min(), vmax=energy.max())
plt.xlabel("alpha")
plt.ylabel("beta")
ax.set_zlabel("energy")
plt.show()
The result is shown below
Note the
cstride
andrstride
parameters.Axes3D.plot_surface documentation.
Used the answer from above (add the
cstride
andrstride
arguments), but wanted to add a visualization of the difference...In my case I'm plotting terrain...
No stride:
With stride: