3D Plotting from X, Y, Z Data, Excel or other Tools

David Williams picture David Williams · Apr 8, 2013 · Viewed 138.7k times · Source

I have data that looks like this:

1000    13  75.2
1000    21  79.21
1000    29  80.02
5000    29  87.9
5000    37  88.54
5000    45  88.56
10000   29  90.11
10000   37  90.79
10000   45  90.87

I want to use the first column as x axis labels, the second column as y axis labels and the third column as the z values. I want to display a surface in that manner. What is the best way to do this? I tried Excel but didn't really get anywhere. Does anyone have any suggestions for a tool to do this? Does anyone know how to do this in Excel?

Thanks

Answer

David Williams picture David Williams · Apr 10, 2013

I ended up using matplotlib :)

from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
x = [1000,1000,1000,1000,1000,5000,5000,5000,5000,5000,10000,10000,10000,10000,10000]
y = [13,21,29,37,45,13,21,29,37,45,13,21,29,37,45]
z = [75.2,79.21,80.02,81.2,81.62,84.79,87.38,87.9,88.54,88.56,88.34,89.66,90.11,90.79,90.87]
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2)
plt.show()