diff options
Diffstat (limited to 'vis/animation/tutorials')
| -rw-r--r-- | vis/animation/tutorials/z_f_x_y.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vis/animation/tutorials/z_f_x_y.py b/vis/animation/tutorials/z_f_x_y.py new file mode 100644 index 0000000..845db0c --- /dev/null +++ b/vis/animation/tutorials/z_f_x_y.py @@ -0,0 +1,27 @@ +import numpy as np +import matplotlib.pyplot as plt +from matplotlib.ticker import MaxNLocator +from matplotlib import cm + +landscape = np.random.randint(1, high=50, size=(10, 10)) + +xs, ys = np.meshgrid(range(10), range(10)) + +# zs = landscape[xs, ys] +zs = (xs-4)**2 + (ys-3)**2 +fig = plt.figure() +ax = fig.add_subplot(111, projection='3d') + +surf = ax.plot_surface(xs, ys, zs, rstride=1, cstride=1, cmap=cm.jet, linewidth=0) +fig.colorbar(surf) + +title = ax.set_title("plot_surface: given X, Y and Z as 2D:") +title.set_y(np.max(zs)+0.01) + +# ax.xaxis.set_major_locator(MaxNLocator(5)) +# ax.yaxis.set_major_locator(MaxNLocator(6)) +# ax.zaxis.set_major_locator(MaxNLocator(5)) + +fig.tight_layout() + +plt.show() |
