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

Home » Public Forums » archive » Re: How to "reuse" a function graphics plot window?
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
Re: How to "reuse" a function graphics plot window? [message #77396] Thu, 25 August 2011 12:01
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Excellent - exactly what I was looking for!


Thanks!

paulv


Michael Galloy wrote:
> On 8/25/11 11:01 AM, Paul van Delst wrote:
>> Hello,
>>
>> This is probably a silly question with a (hopefully) simple answer,
>> but here goes any way...
>>
>> How does one reuse an already created FG plot window?
>>
[snip]
>
> I think the best way to do this would be to use the setData method.
> Something like:
>
> p = plot([0, 1], /nodata)
> for i = 0, np - 1 do begin
> p->setData, x, y[*, i]
> q = get_kbrd(1)
> if (strupcase(q) eq 'Q') then break
> endfor
>
> Mike
Re: How to "reuse" a function graphics plot window? [message #77399 is a reply to message #77396] Thu, 25 August 2011 10:14 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 8/25/11 11:01 AM, Paul van Delst wrote:
> Hello,
>
> This is probably a silly question with a (hopefully) simple answer, but here goes any way...
>
> How does one reuse an already created FG plot window?
>
> A common usage of mine when plotting in DG is to allow myself to sequentially view multiple plots in the same window
> where I control the speed of update via use of get_kbrd(1), eg
>
> for i = 0, np-1 do begin
> plot, x, y[*,i]
> q = get_kbrd(1)
> if ( strupcase(q) eq 'Q' ) then break
> endfor
>
> Here the same plot window is "re-used" for all the subsequent plots. What I came up with via FG is
>
> for i = 0, np-1 do begin
> p = plot(x, y[*,i],/current)
> q = get_kbrd(1)
> if ( strupcase(q) eq 'Q' ) then break
> if ( i lt np-1 ) then p.delete
> endfor
>
> which doesn't work right since the "p.delete" doesn't delete the axes.
>
> The close method is no good since it destroys and creates another window (in another position .... and it steals my
> mouse focus each time too).
>
> Anyone have any ideas? Is there a technique or method that will allow me to do in FG what I have always been able to do
> in DG?
>
> thanks,
>
> paulv
>
>
> p.s. a working procedure exhibiting the above examples is below:
> -----%<-----
> pro blah
>
> nx = 1000
> np = 4
> x = findgen(nx)/100.0
> y = fltarr(nx,np)
> y[*,0] = x^2
> y[*,1] = 0.05*x^3
> y[*,2] = 0.0025*x^4
> y[*,3] = 0.0000125*x^5
>
> for i = 0, np-1 do begin
> plot, x, y[*,i]
> q = get_kbrd(1)
> if ( strupcase(q) eq 'Q' ) then break
> endfor
>
> for i = 0, np-1 do begin
> p = plot(x, y[*,i],/current)
> q = get_kbrd(1)
> if ( strupcase(q) eq 'Q' ) then break
> if ( i lt np-1 ) then p.delete
> endfor
>
> end
> -----%<-----

I think the best way to do this would be to use the setData method.
Something like:

p = plot([0, 1], /nodata)
for i = 0, np - 1 do begin
p->setData, x, y[*, i]
q = get_kbrd(1)
if (strupcase(q) eq 'Q') then break
endfor

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Can IDL receive messages from dlls using call_external
Next Topic: gaussfold

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

Current Time: Wed Oct 08 19:47:20 PDT 2025

Total time taken to generate the page: 0.00610 seconds