Note that there are some explanatory texts on larger screens.

plurals
  1. POPlot a 3D surface from {x,y,z}-scatter data in python
    primarykey
    data
    text
    <p>I'm trying to plot a 3D surface constructed to fit some {x,y,z} points in python -- ideally something like the Mathematica <a href="http://reference.wolfram.com/mathematica/ref/ListSurfacePlot3D.html" rel="noreferrer"><code>ListSurfacePlot3D</code></a> function. Thus far I've tried <code>plot_surface</code> and <code>plot_wireframe</code> on my points to no avail.</p> <p>Only the axes render with <code>plot_surface</code>. <code>plot_wireframe</code> gives a bunch of squigglys, vaguely in the shape of the object, but not the nice sort that is shown in the documentation: <img src="https://i.stack.imgur.com/IEgG5.png" alt="enter image description here"> Compare to the result from <code>ListSurfacePlot3D</code>: <img src="https://i.stack.imgur.com/JJjQP.png" alt="enter image description here"></p> <p>Here is a minimal working example, using a test.csv file I posted <a href="http://pastebin.com/0B1z2SBv" rel="noreferrer">here</a>:</p> <pre><code>import csv from matplotlib import pyplot import pylab from mpl_toolkits.mplot3d import Axes3D hFile = open("test.csv", 'r') datfile = csv.reader(hFile) dat = [] for row in datfile: dat.append(map(float,row)) temp = zip(*(dat)) fig = pylab.figure(figsize=pyplot.figaspect(.96)) ax = Axes3D(fig) </code></pre> <p>Then, either</p> <pre><code>ax.plot_surface(temp[0], temp[1], temp[2]) pyplot.show() </code></pre> <p>or</p> <pre><code>ax.plot_wireframe(temp[0], temp[1], temp[2]) pyplot.show() </code></pre> <p>This is how it renders using <code>plot_surface</code>: <img src="https://i.stack.imgur.com/cULvz.png" alt="enter image description here"> and using <code>plot_wireframe</code>: <img src="https://i.stack.imgur.com/9zQhf.png" alt="enter image description here"> and using <code>ListSurfacePlot3D</code>: <img src="https://i.stack.imgur.com/NPXHe.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload