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

Home » Public Forums » archive » PLOT() function...which WINDOW() to plot to...?
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
PLOT() function...which WINDOW() to plot to...? [message #81352] Wed, 12 September 2012 06:56 Go to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

I have some code that does this:

; Set the graphics buffering
buffer = KEYWORD_SET(png)

then, inside some loops (director and file lists), a window is created
like so:

w = WINDOW( $
WINDOW_TITLE = rts_file_list[i], $
DIMENSIONS = [800,w_ysize], $
BUFFER = buffer )

and then inside an addition loop (data items), a plot is created like so:

index++
pn = PLOT( $
channel_index, new_data, $
XTITLE=xtitle, $
TITLE = item_name[j], $
LAYOUT = [ n_col, n_row, index ], $
NAME = legend_name[0], $
COLOR = 'red', $
THICK = 2, $
CURRENT = w )

Note in the last command the keyword assignment "CURRENT = w".

And then finally,

IF ( buffer ) THEN $
w.SAVE, dir_list[n] + PATH_SEP() + $
FILE_BASENAME(file_root,".bin") + ".png", $
HEIGHT=w_ysize


Note that the main procedure keyword "png" is what determines whether or
not the plots got to a window on screen, or to a buffer. And, if they go
to a buffer, those plots are then saved as a png file.

I have noticed two things:

1) If I have existing graphics windows on screen (say from a bunch of
previous plots) and I run my program to create more onscreen plots, then
if I click on any of the *other* windows, my current plotting run
starts plotting to *that* window, not the one defined by the graphics id
variable "w".

2) If I set the "png" keyword to plot to the buffer so as to create
output files (and thus no onscreen output), if I again click on *any*
existing windows on screen, it becomes the target of the plotting
commands and my new plots get overwritten on anything existing onscreen.
Needless to say the final png output is also screwy.

Now, checking the PLOT() documentation it does not mention at all that
the CURRENT keyword is anything but a binary keyword (unlike the
OVERPLOT keyword where you can specify graphics references).

Fair enough. But, then, how does one set the current plotting window
such that inadvertent, or purposeful, clicks on some other existing
window doesn't cause the plotting to transfer to that window?

I want to create a window, and have everything plot in that window (be
it onscreen or in buffer) regardless of what other graphics windows I
have onscreen that I happen to be looking at and click on.

I presume there is some magical combination of keywords that will do that?

Thanks for any info.

cheers,

paulv
Re: PLOT() function...which WINDOW() to plot to...? [message #81431 is a reply to message #81352] Thu, 13 September 2012 09:32 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, September 12, 2012 3:30:38 PM UTC-6, Paul van Delst wrote:
> Yay! Thanks.
>
>
>
> What's the schedule for v8.2.2 release?
>
>

It's still a little up in the air, but probably around Jan/Feb.
-Chris
Re: PLOT() function...which WINDOW() to plot to...? [message #81432 is a reply to message #81352] Thu, 13 September 2012 09:32 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On Wednesday, September 12, 2012 3:30:38 PM UTC-6, Paul van Delst wrote:
>
> What's the schedule for v8.2.2 release?
>

Hi Paul,

We're currently planning to release 8.2.2 at the end of December or the beginning of January.

mp
Re: PLOT() function...which WINDOW() to plot to...? [message #81438 is a reply to message #81352] Wed, 12 September 2012 14:31 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Yay! Thanks.

What's the schedule for v8.2.2 release?

cheers,

paulv


On 09/12/12 15:47, Chris Torrence wrote:
> Hi Paul,
>
> I just changed the CURRENT keyword for IDL 8.2.2, so you can pass in
> a graphic reference, just like you were trying to do in your original
> example. It will automatically make that window be current and ensure
> that your new graphics goes into that window.
>
> Cheers, Chris ExelisVIS
Re: PLOT() function...which WINDOW() to plot to...? [message #81441 is a reply to message #81352] Wed, 12 September 2012 13:31 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, September 12, 2012 1:53:12 PM UTC-6, David Fanning wrote:
> Chris Torrence writes:
>
>
>
>> I just changed the CURRENT keyword for IDL 8.2.2, so you can
>
>> pass in a graphic reference.
>
>
>
> Any chance we can sneak this into IDL 8.2.1 so we can
>
> have it this year? :-)
>
>
>
> Cheers,
>
>
>
> David
>

It's too late for 8.2.1, but I can email you the code if you really want the changes. However, that won't do any good for anyone else...
-Chris
Re: PLOT() function...which WINDOW() to plot to...? [message #81442 is a reply to message #81352] Wed, 12 September 2012 12:52 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris Torrence writes:

> I just changed the CURRENT keyword for IDL 8.2.2, so you can
> pass in a graphic reference.

Any chance we can sneak this into IDL 8.2.1 so we can
have it this year? :-)

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: PLOT() function...which WINDOW() to plot to...? [message #81443 is a reply to message #81352] Wed, 12 September 2012 12:47 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Paul,

I just changed the CURRENT keyword for IDL 8.2.2, so you can pass in a graphic reference, just like you were trying to do in your original example. It will automatically make that window be current and ensure that your new graphics goes into that window.

Cheers,
Chris
ExelisVIS
Re: PLOT() function...which WINDOW() to plot to...? [message #81444 is a reply to message #81352] Wed, 12 September 2012 11:59 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 09/12/12 11:58, Paul van Delst wrote:
> Hello,
>
> On 09/12/12 11:07, David Fanning wrote:
>> Paul van Delst writes:
>>
>>> I want to create a window, and have everything plot in that window (be
>>> it onscreen or in buffer) regardless of what other graphics windows I
>>> have onscreen that I happen to be looking at and click on.
>>>
>>> I presume there is some magical combination of keywords that will do
>>> that?
>>
>> I think you have to write your loop like this, using
>> the SetCurrent method on the window you want to draw
>> into:
>>
>> w.SetCurrent
>> index++
>> pn = PLOT( $
> [snip]
>> CURRENT = 1 )
>
> Yeah, I did look at that method (and implemented it as you say) but it
> does not solve the basic problem.

And it introduces a new one if I set the output to go to buffer:

IDL> display_diffs, names=['gfortran 4.4.6 PROD', 'baseline'], /png
..etc..
% Attempt to call undefined method: 'GRAPHICSBUFFER::SETCURRENT'.
% Execution halted at: DISPLAY_RESULT_DIFFERENCES 103
CRTM/branches/RB-2.1/src/Build/test/forward/display_diffs.pr o
% $MAIN$

So if you set the BUFFER keyword in the WINDOW() call, the method
SetCurrent becomes invalid for the graphics id.

So now I have to a
IF ( ~buffer ) THEN w.SetCurrent
before each FG call.

Wha...? I gotta be doing something wrong here.


cheers,

paulv
Re: PLOT() function...which WINDOW() to plot to...? [message #81447 is a reply to message #81352] Wed, 12 September 2012 09:14 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> I want to create a window, and have everything plot in that window (be
> it onscreen or in buffer) regardless of what other graphics windows I
> have onscreen that I happen to be looking at and click on.
>
> I presume there is some magical combination of keywords that will do that?

I think you have to write your loop like this, using
the SetCurrent method on the window you want to draw
into:

w.SetCurrent
index++
pn = PLOT( $
channel_index, new_data, $
XTITLE=xtitle, $
TITLE = item_name[j], $
LAYOUT = [ n_col, n_row, index ], $
NAME = legend_name[0], $
COLOR = 'red', $
THICK = 2, $
CURRENT = 1 )

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: PLOT() function...which WINDOW() to plot to...? [message #81449 is a reply to message #81352] Wed, 12 September 2012 08:58 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

On 09/12/12 11:07, David Fanning wrote:
> Paul van Delst writes:
>
>> I want to create a window, and have everything plot in that window (be
>> it onscreen or in buffer) regardless of what other graphics windows I
>> have onscreen that I happen to be looking at and click on.
>>
>> I presume there is some magical combination of keywords that will do that?
>
> I think you have to write your loop like this, using
> the SetCurrent method on the window you want to draw
> into:
>
> w.SetCurrent
> index++
> pn = PLOT( $
[snip]
> CURRENT = 1 )

Yeah, I did look at that method (and implemented it as you say) but it
does not solve the basic problem.

If I click on a different window in that infinitesimal amount of time
between the execution of
w.SetCurrent
and
pn = PLOT(...)
the same problem crops up since "w" is no longer the current window.

It's typical that, while plot#n is being written to screen, I'm looking
at plot#(n-1). As soon as I click on that window and give it focus,
everything goes pear-shaped. You're effectively forced to do non-IDL-y
stuff while the program is (slowly) plotting all the FG graphics.

Additionally, it adds the burden of having to put a "w.SetCurrent"
before every single FG call! And that *still* may not be efficacious
depending on how "click-y" one is with existing windows.

It seems to be such a gaping hole in the basic design of these graphics
features that I am sure I am still missing something.

- With DG clicking on windows was a completely separate operation from
setting the current graphics window in a program via WSET.
- With FG, the two operations are intertwined. Clicking on *ANY*
graphics window has exactly the same effect as executing the SetCurrent
method... even if the program is running, and even if the program has
been directed to send all graphics to a buffer rather than onscreen.

Unless there is something in the documentation that I'm missing (or just
misunderstanding), I regard this as a fundamental flaw: there is no way
for a programmer to guarantee the code will run the way it was intended
(i.e. *always* plot to *this* window).

Anyhoo... I guess I'll bring the donuts to the next IDL support group
meeting...

cheers,

paulv

p.s. Argh!
Re: PLOT() function...which WINDOW() to plot to...? [message #81450 is a reply to message #81352] Wed, 12 September 2012 08:07 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> I want to create a window, and have everything plot in that window (be
> it onscreen or in buffer) regardless of what other graphics windows I
> have onscreen that I happen to be looking at and click on.
>
> I presume there is some magical combination of keywords that will do that?

I think you have to write your loop like this, using
the SetCurrent method on the window you want to draw
into:

w.SetCurrent
index++
pn = PLOT( $
channel_index, new_data, $
XTITLE=xtitle, $
TITLE = item_name[j], $
LAYOUT = [ n_col, n_row, index ], $
NAME = legend_name[0], $
COLOR = 'red', $
THICK = 2, $
CURRENT = 1 )

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Coyote Updates
Next Topic: Is IDL 8.2 Workbench Slow, Too?

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

Current Time: Wed Oct 08 18:39:35 PDT 2025

Total time taken to generate the page: 0.00803 seconds