How can I change axes values that are displayed on chart in 3D surface plot in Matplotlib?
I have 16, 32, 64 and 128 values on X axis but matplotlib displays 10, 20, 30, 40, etc. What should I do to display it correctly (I mean exactly 16, 32, 64 and 128 values)?
Below is the code:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
plt.title("Just simple text of 3D plot")
X = [
[16, 16, 16, 16, 16, 16, 16],
[32, 32, 32, 32, 32, 32, 32],
[64, 64, 64, 64, 64, 64, 64],
[128, 128, 128, 128, 128, 128, 128]
]
Y = [
[1, 2, 3, 4, 5, 6, 7],
[1, 2, 3, 4, 5, 6, 7],
[1, 2, 3, 4, 5, 6, 7],
[1, 2, 3, 4, 5, 6, 7]
]
Z = [
[550 ,700 ,650 ,550 ,300 ,100 ,5],
[650 ,760 ,720 ,620 ,350 ,150 ,15],
[720 ,800 ,780 ,700 ,500 ,250 ,50 ],
[580 ,690 ,600 ,550 ,250 ,50 ,5 ]
]
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=False)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.view_init(elev=33, azim=155)
plt.savefig("3d_test.png")