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

Home » Public Forums » archive » Synchronizing xrange of cgZPlot with another plot
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
Synchronizing xrange of cgZPlot with another plot [message #89886] Wed, 17 December 2014 12:20 Go to next message
rlord is currently offline  rlord
Messages: 2
Registered: December 2014
Junior Member
Hi,

I am trying to plot a share price (for example) in one draw widget using cgZPlot, and have a volume plot (for example) in another draw widget below the cgZPlot figure using cgPlot.

However, as I zoom/pan the cgZPlot figure, I want the other plot's xrange to stay in sync.

Any ideas?
Richard
Re: Synchronizing xrange of cgZPlot with another plot [message #89887 is a reply to message #89886] Wed, 17 December 2014 12:31 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rlord@ska.ac.za writes:

> I am trying to plot a share price (for example) in one draw widget using cgZPlot, and have a volume plot (for example) in another draw widget below the cgZPlot figure using cgPlot.
>
> However, as I zoom/pan the cgZPlot figure, I want the other plot's xrange to stay in sync.
>
> Any ideas?

Write your own "sharezoom" object from a subclassed cgZPlot object. Have
it "know" about the volume plot. Override the DrawPlot method of your
new object to update both plots.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Synchronizing xrange of cgZPlot with another plot [message #89889 is a reply to message #89887] Wed, 17 December 2014 12:56 Go to previous messageGo to next message
rlord is currently offline  rlord
Messages: 2
Registered: December 2014
Junior Member
On Wednesday, December 17, 2014 10:32:00 PM UTC+2, David Fanning wrote:
> rlord@ska.ac.za writes:
>
>> I am trying to plot a share price (for example) in one draw widget using cgZPlot, and have a volume plot (for example) in another draw widget below the cgZPlot figure using cgPlot.
>>
>> However, as I zoom/pan the cgZPlot figure, I want the other plot's xrange to stay in sync.
>>
>> Any ideas?
>
> Write your own "sharezoom" object from a subclassed cgZPlot object. Have
> it "know" about the volume plot. Override the DrawPlot method of your
> new object to update both plots.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")


Hi David,

Thank you for the quick reply. I think I need to first learn a bit about writing object-oriented code in IDL to fully understand your answer. But at least you confirmed there is no easy way to do this.

I will probably start by making a copy of cgZPlot, and call it, say, ShareZoom, which will then accept two arrays for the two y-axes (the x-axis is the same for both plots). This, for me, seems to be the easiest way for ShareZoom to "know" about both plots. Updating the DrawPlot method should hopefully be fairly easy.

Best Regards,
Richard

PS: cgZPlot is really a fantastic tool!
Re: Synchronizing xrange of cgZPlot with another plot [message #89890 is a reply to message #89889] Wed, 17 December 2014 13:00 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rlord@ska.ac.za writes:

> Thank you for the quick reply. I think I need to first learn a bit about writing object-oriented code in IDL to fully understand your answer. But at least you confirmed there is no easy way to do this.
>
> I will probably start by making a copy of cgZPlot, and call it, say, ShareZoom, which will then accept two arrays for the two y-axes (the x-axis is the same for both plots). This, for me, seems to be the easiest way for ShareZoom to "know" about both plots. Updating the DrawPlot method should hopefully be fairly easy.

I estimate this should take you about 10 minutes, max! Not including
learning about objects, of course. But, once you do, you will understand
why this is so incredible easy to do.

> PS: cgZPlot is really a fantastic tool!

Thank you. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Matlab "strel" function - is there an IDL equivalent?
Next Topic: reading binary file with READ_BINARY

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

Current Time: Wed Oct 08 13:39:48 PDT 2025

Total time taken to generate the page: 0.00581 seconds