Pan/Zoom Line Plot in Coyote Graphics

David Fanning news at idlcoyote.com
Thu May 17 11:05:48 EDT 2012


Folks,

At my new job, we had a need to be able to zoom into a
lot of data very quickly and then pan around the data
to see what points are in the immediate vicinity.

Python has a rudimentary capability like we wanted, but
it's just a bit clunky and slow. You can pan IDL 8.1
graphics (sometimes even when you don't want to!), but
you can easily pan your plot off the face of the Earth
and good luck writing or modifying one of *those* programs!

So, to make a long story short, I had to un-retire for
a day to write what we wanted in Coyote Graphics. It's
pretty darn slick, even if I say so myself. :-)

I have added it to the Coyote Library this morning:

   http://www.idlcoyote.com/programs/cgzplot.pro

It is written as an object (although called like a procedure),
and is a subclass of a new cgGraphicsKeywords object which
handles graphics keywords. You will need this program, too.

   http://www.idlcoyote.com/programs/cggraphicskeywords__define.pro

Basically, the program is an interactive wrapper to cgPlot
and is called *exactly* like cgPlot, with all of cgPlot's
keywords, etc.

   IDL> cgZPlot, cgDemodata(1), PSym=2, Color='red'

The operations are simple. Zoom with the LEFT mouse button and
pan with the RIGHT mouse button.

If you click inside the plot with the LEFT mouse button, you can
draw a rubberband zoom box to make your initial zoom selection.
You can tweak your zoom by clicking the LEFT mouse button outside
of the plot boundaries. Clicking at the top or bottom of the plot
will zoom in or out, respectively, of the X axis. Clicking to the
right or left of the plot will do the same with the Y axis. To
restore the plot to its original dimensions, simply click and 
release inside the plot without moving the mouse. Complete 
directions are in the documentation. 

If a plot is zoomed, you can use the RIGHT mouse button to pan the
plot in the graphics window.

Panning and zooming are incredibly fast and smooth, even with a full
size window on my display.

Since I am retired, I figure I am done holding everyone's hand, so
if you want nice looking file output, you will have to install 
ImageMagick and GhostScript (for PDF output). I figure most 
Coyote Library users will have these installed by now. If not, 
there is no hope for them anyway. :-)

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")



More information about the Python-list mailing list