comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Pan/Zoom Line Plots with Coyote Graphics
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Pan/Zoom Line Plots with Coyote Graphics [message #80153] Thu, 17 May 2012 08:15 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80204 is a reply to message #80153] Tue, 22 May 2012 10:49 Go to previous messageGo to next message
Raphael Sadoun is currently offline  Raphael Sadoun
Messages: 4
Registered: May 2012
Junior Member
On May 22, 1:37 pm, David Fanning <n...@idlcoyote.com> wrote:
>
>> Will it be possible some day to make an overplot or to add a legend to
>> the plot, or not?
>
> Let me put it this way. If I find I *need* that capability, it
> is certainly possible. I can imagine how I would do it. But,
> if you need it anytime soon, young Raphael is going to have
> to drop out of graduate school and write it for you.

Well, I will most likely be less busy after I get my PhD, that's for
sure! :-)
In the meantime, I don't think I can find enough free time to
implement new features
in cgZplot. The best thing I can offer for interactive overplots and
legends is the Interactive Graphics Library :

http://igl.googlecode.com/files/Interactive_Graphics_Library _1.0.zip

which works like the regular IDL plotting commands and has also
interactivity (zoom/pan)
but probably not as fast as cgZplot unfortunately.


Cheers,

Raphael
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80218 is a reply to message #80153] Tue, 22 May 2012 04:43 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> P.S. I am *giving* the friggin' E-book away now, just so
> I can say *someone* read the darn thing! I used to think
> I had some friends, or at least family. This is karmic payback
> for finding all those excuses over the years for not
> attending those awful family gatherings. :-(

My mother *did* say she liked it, although she has
still not written the promised Amazon review. :-)

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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80219 is a reply to message #80153] Tue, 22 May 2012 04:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fab writes:

> Nice! Retirement seems to inspire you ;-)
>
> The linestyle keyword doesn't work: cgZPlot, cgDemoData(1), LINESTYLE=1

Yikes! How could that keyword have gone missing among the 80
or so I was herding around!? You will need a new cgGraphicsKeywords
object, which you can find here:

http://www.idlcoyote.com/programs/graphicskeywords__define.p ro

> Will it be possible some day to make an overplot or to add a legend to
> the plot, or not?

Let me put it this way. If I find I *need* that capability, it
is certainly possible. I can imagine how I would do it. But,
if you need it anytime soon, young Raphael is going to have
to drop out of graduate school and write it for you.

Actually, as I think about it, it's not that hard. But,
I prefer to spend my retirement years writing books that
no one wants to read. :-)

Cheers,

David

P.S. I am *giving* the friggin' E-book away now, just so
I can say *someone* read the darn thing! I used to think
I had some friends, or at least family. This is karmic payback
for finding all those excuses over the years for not
attending those awful family gatherings. :-(

http://www.idlcoyote.com/reading/iceandwind.php


--
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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80220 is a reply to message #80153] Tue, 22 May 2012 03:49 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi David,

Nice! Retirement seems to inspire you ;-)

The linestyle keyword doesn't work: cgZPlot, cgDemoData(1), LINESTYLE=1

Will it be possible some day to make an overplot or to add a legend to
the plot, or not?

Thanks a lot!

Fab

On 05/21/2012 11:11 PM, David Fanning wrote:
> David Fanning writes:
>
>> 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.
>
> I modified this Zoom/Pan program this morning to add
> more functionality. There is now a multiple REDO functionality
> to go along with the multiple UNDO functionality that was
> previously in the program.
>
> Also, I added the ability to "adjust" the Y range of the
> zoomed-in plot, to accommodate the minimum and maximum
> data values of the data in the X range view of the data.
> Combined with the UNDO/REDO, this gives you a way to zoom
> into the data very closely, but to back out to see an "overview"
> of the actual data in the view's X range, then UNDO that to return to
> your close-in view of the data itself. The data adjustment,
> UNDO, and REDO can be done with buttons in the pull-down menu
> or by using accelerator keys (very fast!!). We use this
> to good effect with lidar data.
>
> I also realized that people might want to use this
> functionality in their own widget programs. (So you could
> look at multiple files, for example.) So, I have added a
> PARENT keyword that allows you to specify your own parent
> widget for this display window. Essentially, this program
> becomes an interactive Zoom/Pan line plot window in your
> own program. (It is a compound widget object, if you like.)
> Here is a very simplified program that demonstrates how to
> do this.
>
> PRO Test
> tlb = Widget_Base(Title='My Program')
> cgZPlot, cgDemodata(1), PSYM=2, Color='dodger blue', Parent=tlb
> Widget_Control, tlb, /Realize
> Widget_Control, 'myprogram', tlb, /NoBlock
> END
>
> You can download the updated program here:
>
> http://www.idlcoyote.com/programs/cgzplot.pro
>
> Cheers,
>
> David
>
>
>
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80222 is a reply to message #80153] Mon, 21 May 2012 14:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> 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.

I modified this Zoom/Pan program this morning to add
more functionality. There is now a multiple REDO functionality
to go along with the multiple UNDO functionality that was
previously in the program.

Also, I added the ability to "adjust" the Y range of the
zoomed-in plot, to accommodate the minimum and maximum
data values of the data in the X range view of the data.
Combined with the UNDO/REDO, this gives you a way to zoom
into the data very closely, but to back out to see an "overview"
of the actual data in the view's X range, then UNDO that to return to
your close-in view of the data itself. The data adjustment,
UNDO, and REDO can be done with buttons in the pull-down menu
or by using accelerator keys (very fast!!). We use this
to good effect with lidar data.

I also realized that people might want to use this
functionality in their own widget programs. (So you could
look at multiple files, for example.) So, I have added a
PARENT keyword that allows you to specify your own parent
widget for this display window. Essentially, this program
becomes an interactive Zoom/Pan line plot window in your
own program. (It is a compound widget object, if you like.)
Here is a very simplified program that demonstrates how to
do this.

PRO Test
tlb = Widget_Base(Title='My Program')
cgZPlot, cgDemodata(1), PSYM=2, Color='dodger blue', Parent=tlb
Widget_Control, tlb, /Realize
Widget_Control, 'myprogram', tlb, /NoBlock
END

You can download the updated program here:

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

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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80247 is a reply to message #80153] Fri, 18 May 2012 08:23 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gianguido Cianci writes:

> cgzplot is quick! though I was surprised not to be
> able to zoom in more than once. Is this an intended
> behaviour?

Whoops! Sorry. This had to do with a late change to
account for log axes, which I had implemented incorrectly.
The corrected program is here:

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

Thanks for the heads-up. :-)

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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80249 is a reply to message #80153] Fri, 18 May 2012 08:06 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gianguido Cianci writes:

> cgzplot is quick! though I was surprised not to be able to zoom in more than once. Is this an intended behaviour?

Whoops! No. How did that happen!? :-(

Must have something to do with the UNDO mechanism. I'll look into
it.

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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80261 is a reply to message #80153] Fri, 25 May 2012 08:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Yes, this is probably what you would have to do. Since
> this is a specialized use for this functionality, I think
> I would probably just write a TimeZPlot subclass of the
> cgZPlot object and modify the zoom event handler to
> check for the range and set the labeling accordingly.

I might add that you would certainly be able to
finish this and have it working in the hour (at least!)
it will take you to understand how events are handled
in the Function Graphics system. :-)

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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80262 is a reply to message #80153] Fri, 25 May 2012 08:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mark Piper writes:

> Zoom by rolling the scroll wheel. I chose 'days' as the tickunit;
> you may want to build logic into the window (using NG event handling)
> to change XTICKUNITS and XTICKFORMAT conditioned on p.xrange.

Yes, this is probably what you would have to do. Since
this is a specialized use for this functionality, I think
I would probably just write a TimeZPlot subclass of the
cgZPlot object and modify the zoom event handler to
check for the range and set the labeling accordingly.

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.")
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80263 is a reply to message #80153] Fri, 25 May 2012 07:48 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On Friday, May 25, 2012 3:19:03 AM UTC-6, Fab wrote:
> Bonus question: are IDL NG routines better at labeling time
> automatically? (in other words: should I go for IDL 8.2?)

Here's a start:

pro timeaxis_ex
compile_opt idl2

; Ten days of data; each sample taken at noon UTC.
time_min = julday(1,20,2012,12,0,0)
time_max = julday(1,29,2012,12,0,0)
time = timegen(start=time_min, final=time_max)
foo = randomn(1, 10)

p = plot(time, foo, 'r', $
xtickunits='days', $
xtickformat='(C(CMoA,1x,CDI))', $
title='Time Axis Example')
end

Zoom by rolling the scroll wheel. I chose 'days' as the tickunit; you may want to build logic into the window (using NG event handling) to change XTICKUNITS and XTICKFORMAT conditioned on p.xrange.

mp
Re: Pan/Zoom Line Plots with Coyote Graphics [message #80270 is a reply to message #80153] Fri, 25 May 2012 02:19 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi,

One of the nicest application I could imagine for this zoom plot is the
capability to explore time series. However, I was not able to produce
"satisfying" (nice-looking) visualizations using LABEL_DATE in a generic
way (that means, for time series of any length or sampling resolution).
I don't see any logic in the way IDL decides where to put its
tick-marks: sometimes at noon, sometimes at midnight, sometimes is the
day tick in the middle of what seems to be a day (12:00 -> 12:00),
sometimes not, etc...

Does someone has a suggestion on how to use label_Date?

Bonus question: are IDL NG routines better at labeling time
automatically? (in other words: should I go for IDL 8.2?)

Thanks a lot


On 05/17/2012 05:15 PM, David Fanning wrote:
> 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
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Type of array to store large numbers
Next Topic: Re: ps_start and color

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:53:20 PDT 2025

Total time taken to generate the page: 0.00550 seconds