Skip to content

Instantly share code, notes, and snippets.

@biplab37
Created April 26, 2020 05:21
Show Gist options
  • Save biplab37/ff12f4184789862ffd745931046afb4e to your computer and use it in GitHub Desktop.
Save biplab37/ff12f4184789862ffd745931046afb4e to your computer and use it in GitHub Desktop.
3d plot matplotlib

3D plot in matplotlib


import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

data = np.loadtxt("data.dat")

X, Y = np.meshgrid( data[:,0], data[:,1])
Z = np.tile( data[:,2], (len(data[:,2]), 1))

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,Z)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment