0

I just used numpy.loadtxt('filename', usecols=(0,)) to load a csv with the following format:

x,y,z
1.1,2.2,3.3
5.5,1.45,6.77

(There are ~1M lines). I'd like to make a scatterplot. I searched the web and found numpy.meshgrid and mlab.surf but I'm not sure what to do. Please point me in the right direction.

1
  • Thank you,Steve.Your method works.Any one has any idea about surface plotvia mlab.surf? Commented Aug 8, 2013 at 8:38

2 Answers 2

1

I think you can use matplotlib, it's very powerful, and widely used, most importantly, it has good document and is easy to use.

Hope helps!

Sign up to request clarification or add additional context in comments.

Comments

1

There is a very simple example from here.

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

def randrange(n, vmin, vmax):
    return (vmax-vmin)*np.random.rand(n) + vmin

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100
for c, m, zl, zh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
    xs = randrange(n, 23, 32)
    ys = randrange(n, 0, 100)
    zs = randrange(n, zl, zh)
    ax.scatter(xs, ys, zs, c=c, marker=m)

ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')

plt.show()

You just need to parse your data instead of using randrange.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.