Skip to content

Instantly share code, notes, and snippets.

@shubham-singh-ss
Created July 4, 2019 05:03

Revisions

  1. shubham-singh-ss created this gist Jul 4, 2019.
    13 changes: 13 additions & 0 deletions 3d.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    from matplotlib import cm
    from mpl_toolkits.mplot3d import Axes3D
    import matplotlib.pyplot as plt
    import numpy as np
    fig = plt.figure()
    ax = fig.gca(projection='3d')
    X = np.arange(-10, 10, 0.1)
    Y = np.arange(-10, 10, 0.1)
    X, Y = np.meshgrid(X, Y)
    R = np.sqrt(X**2 + Y**2)
    Z = np.sin(R)
    surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm)
    plt.show()