You can read data directly from some file and graph.
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm import numpy as np from sys import argv x,y,z = np.loadtxt('your_file', unpack=True) fig = plt.figure() ax = Axes3D(fig) surf = ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.1) fig.colorbar(surf, shrink=0.5, aspect=5) plt.savefig('teste.pdf') plt.show()
If necessary, you can pass vmin and vmax to determine the range of the color scale, for example
surf = ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.1, vmin=0, vmax=2000)

Bonus Section
I was wondering how to make some interactive graphs, in this case with artificial data
from __future__ import print_function from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets from IPython.display import Image from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np from mpl_toolkits import mplot3d def f(x, y): return np.sin(np.sqrt(x ** 2 + y ** 2)) def plot(i): fig = plt.figure() ax = plt.axes(projection='3d') theta = 2 * np.pi * np.random.random(1000) r = i * np.random.random(1000) x = np.ravel(r * np.sin(theta)) y = np.ravel(r * np.cos(theta)) z = f(x, y) ax.plot_trisurf(x, y, z, cmap='viridis', edgecolor='none') fig.tight_layout() interactive_plot = interactive(plot, i=(2, 10)) interactive_plot
Emanuel Fontelles Sep 21 '17 at 23:18 2017-09-21 23:18
source share