[SciPy-user] surface plotting

Joe Harrington jh@physics.ucf....
Fri Nov 30 14:28:25 CST 2007

> For the purposes of your class, I find that a simple imshow or pcolor
> of 2D data with a color map is usually good enough to visualize a 2D
> array.  Surf doesn't really add much unless you are interactively
> panning and zooming, when the movement generates extra 3D visual cues.

Mostly we use a combination of imshow and ds9 in astronomy.  There is a
*lot* of zooming and panning, and real-time, interactive colormap and
scaling manipulations, and zooming the cursor around and watching what
values go under the cursor.  If there's a way to do any of those in
matplotlib it would be good to know how, but I didn't see it in the
manual.  The numdisplay interface to ds9 is pretty good, but not
perfect, as it interpolates the image before sending it to ds9, which is
a throwback to an interface defined in the days of yore.

But, the particular application for which surface really stands out is
looking at the relative brightnesses of stars.  Yeah, you can get an
idea of it with a colormap, but green is not three times red, and even
shades of gray are hard to divide by eye.  Differing heights are easy to
do by eye.

Within that category, the one thing I simply can't do well with an image
display is look at bad pixels.  To find these, and find if you've killed
them all, you really need to do an edge-on look at a surface plot.  With
images that are several k by several k, a single pixel just gets
swallowed up in an image display.  Its spike does not get swallowed up.
Also, a good 2D display will examine the histogram and scale to, say 98%
of the histogram so that spurious spikes in the data with values of
10**12 don't make it impossible to see the stars.

For this particular application, surface really is the only good way
I've found.

As I said in an earlier post, the matplotlib surface looks fine, except
that it is too slow.  I'm not sure if that's because the other methods
I've used are in compiled code or if there is some better algorithm.
But, I've been using surface plots for ~20 years, and the computers back
then were slower than current ones by more than the difference between
compiled and python code, I think.  The IRAF package is open-source and
has such an algorithm, though it's in a bowdlerized version of FORTRAN.


More information about the SciPy-user mailing list