Plot3 in Python – ‘almost’ like Matlab

Here’s an interesting picture titled “language family” from 1985!! Found via this blog.

Python_and_language_family

But this post is really about mimicking  Matlab’s very useful plot3 command in python using matplotlib !!

The following function gives a bare bone plot3 command in python.

Plot3 in python

def plot3(a,b,c,mark="o",col="r"):
  from matplotlib import pyplot
  import pylab
  from mpl_toolkits.mplot3d import Axes3D
  pylab.ion()
  fig = pylab.figure()
  ax = Axes3D(fig)
  ax.scatter(a, b, c,marker=mark,color=col)

Advertisements

One thought on “Plot3 in Python – ‘almost’ like Matlab

  1. Pingback: Python VTK script to Display 3D xyz data | SukhbinderSingh.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s