Relationship between IDLgrXXXX and associated NG functions. Was: IDL documentation gripe - How to erase a new graphics window?

  • Follow


Hello,

I've started replacing the DG draw widgets in my widget apps with NG window widgets. The way I use a particular app was
to plot different things based on a selection from a button group. In DG there's no worries - you just call plot and the
erase happens automagically and the new plot appears. But in NG the plots just pile on top of each other. I've searched
the IDL documentation for the PLOT() and WINDOW() functions but there doesn't appear to be an "Erase" method.

However, when I look at the IDLgrWindow window documentation there is the Erase method listed.

Which does work with the window created using Window(),e.g.

IDL> w=window()
% Loaded DLM: XML.
IDL> p=plot(indgen(100),current=w)
IDL> w.erase

So, does this mean ALL IDLgrXXXX methods work with the associated NG functions (e.g. IDLgrPlot for PLOT(), IDLgrSurface
for SURFACE() etc)?

And what about vice-versa?

cheers,

paulv

0
Reply paul.vandelst (1947) 5/1/2012 2:06:59 PM

Paul van Delst writes: 

> I've started replacing the DG draw widgets in my widget apps with NG window widgets. The way I use a particular app was
> to plot different things based on a selection from a button group. In DG there's no worries - you just call plot and the
> erase happens automagically and the new plot appears. But in NG the plots just pile on top of each other. I've searched
> the IDL documentation for the PLOT() and WINDOW() functions but there doesn't appear to be an "Erase" method.
> 
> However, when I look at the IDLgrWindow window documentation there is the Erase method listed.
> 
> Which does work with the window created using Window(),e.g.
> 
> IDL> w=window()
> % Loaded DLM: XML.
> IDL> p=plot(indgen(100),current=w)
> IDL> w.erase
> 
> So, does this mean ALL IDLgrXXXX methods work with the associated NG functions (e.g. IDLgrPlot for PLOT(), IDLgrSurface
> for SURFACE() etc)?
> 
> And what about vice-versa?

You must be living in a perfect world!

I would say the connection between IDLgrXXXX methods
and function graphics routines is "casual" at best.
Maybe "haphazard" or "accidental" is a better description.
Most things work right up until you are too committed to
turn back. :-)

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.")
0
Reply news8567 (866) 5/1/2012 2:27:01 PM


Crikey, even the erase method doesn't work. And by "work" I mean according to:

> e·rase/iˈrās/
> Verb:	
>     Rub out or remove (writing or marks).
>     Remove all traces of.

If I do this:

IDL> w=window()
% Loaded DLM: XML.
IDL> p=plot(lindgen(100),/current)
IDL> w.erase
IDL> p=plot((findgen(100)^2)/1000.0,/current)

The first plot, which I erased, reappears! ARGHHHH!

Is this a known bug or a "feature"?

IDL> print, !version
{ x86 linux unix linux 8.1 Mar  9 2011      32      64}

Does anyone know what is the sequence of commands to do what I would like to do? That is:
 1) plot some data in the current window
 2) erase the plot in the current window (data, axes, titles, everything)
 3) plot some different data in that same, current window.
   3a) And not have the original plot reappear.


not-so-cheerily yours,

paulv


p.s. Let me double check something:

IDL> help, !PI
<Expression>    FLOAT     =       3.14159

phewph.


On 05/01/12 10:06, Paul van Delst wrote:
> Hello,
> 
> I've started replacing the DG draw widgets in my widget apps with NG window widgets. The way I use a particular app was
> to plot different things based on a selection from a button group. In DG there's no worries - you just call plot and the
> erase happens automagically and the new plot appears. But in NG the plots just pile on top of each other. I've searched
> the IDL documentation for the PLOT() and WINDOW() functions but there doesn't appear to be an "Erase" method.
> 
> However, when I look at the IDLgrWindow window documentation there is the Erase method listed.
> 
> Which does work with the window created using Window(),e.g.
> 
> IDL> w=window()
> % Loaded DLM: XML.
> IDL> p=plot(indgen(100),current=w)
> IDL> w.erase
> 
> So, does this mean ALL IDLgrXXXX methods work with the associated NG functions (e.g. IDLgrPlot for PLOT(), IDLgrSurface
> for SURFACE() etc)?
> 
> And what about vice-versa?
> 
> cheers,
> 
> paulv
> 
0
Reply paul.vandelst (1947) 5/1/2012 2:32:04 PM

On 05/01/12 10:27, David Fanning wrote:
> Paul van Delst writes: 
> 
>> I've started replacing the DG draw widgets in my widget apps with NG window widgets. The way I use a particular app was
>> to plot different things based on a selection from a button group. In DG there's no worries - you just call plot and the
>> erase happens automagically and the new plot appears. But in NG the plots just pile on top of each other. I've searched
>> the IDL documentation for the PLOT() and WINDOW() functions but there doesn't appear to be an "Erase" method.
>>
>> However, when I look at the IDLgrWindow window documentation there is the Erase method listed.
>>
>> Which does work with the window created using Window(),e.g.
>>
>> IDL> w=window()
>> % Loaded DLM: XML.
>> IDL> p=plot(indgen(100),current=w)
>> IDL> w.erase
>>
>> So, does this mean ALL IDLgrXXXX methods work with the associated NG functions (e.g. IDLgrPlot for PLOT(), IDLgrSurface
>> for SURFACE() etc)?
>>
>> And what about vice-versa?
> 
> You must be living in a perfect world!
> 
> I would say the connection between IDLgrXXXX methods
> and function graphics routines is "casual" at best.
> Maybe "haphazard" or "accidental" is a better description.
> Most things work right up until you are too committed to
> turn back. :-)

Well, you know, this is probably about the sixth or seventh time where, after a period of weeks/months of doing actual
work, I come back to some IDL apps thinking "you know, it sure would be neat to use NG in this application". And then,
after a day of mucking about trying to figure out the cognitive pathways that led to the NG system, I realise why I
stopped doing this the last time.

It is quite frustrating.

paulv

0
Reply paul.vandelst (1947) 5/1/2012 2:48:33 PM

On Tuesday, May 1, 2012 8:48:33 AM UTC-6, Paul van Delst wrote:
> On 05/01/12 10:27, David Fanning wrote:
> > Paul van Delst writes:=20
> >=20
> >> I've started replacing the DG draw widgets in my widget apps with NG w=
indow widgets. The way I use a particular app was
> >> to plot different things based on a selection from a button group. In =
DG there's no worries - you just call plot and the
> >> erase happens automagically and the new plot appears. But in NG the pl=
ots just pile on top of each other. I've searched
> >> the IDL documentation for the PLOT() and WINDOW() functions but there =
doesn't appear to be an "Erase" method.
> >>
> >> However, when I look at the IDLgrWindow window documentation there is =
the Erase method listed.
> >>
> >> Which does work with the window created using Window(),e.g.
> >>
> >> IDL> w=3Dwindow()
> >> % Loaded DLM: XML.
> >> IDL> p=3Dplot(indgen(100),current=3Dw)
> >> IDL> w.erase
> >>
> >> So, does this mean ALL IDLgrXXXX methods work with the associated NG f=
unctions (e.g. IDLgrPlot for PLOT(), IDLgrSurface
> >> for SURFACE() etc)?
> >>
> >> And what about vice-versa?
> >=20
> > You must be living in a perfect world!
> >=20
> > I would say the connection between IDLgrXXXX methods
> > and function graphics routines is "casual" at best.
> > Maybe "haphazard" or "accidental" is a better description.
> > Most things work right up until you are too committed to
> > turn back. :-)
>=20
> Well, you know, this is probably about the sixth or seventh time where, a=
fter a period of weeks/months of doing actual
> work, I come back to some IDL apps thinking "you know, it sure would be n=
eat to use NG in this application". And then,
> after a day of mucking about trying to figure out the cognitive pathways =
that led to the NG system, I realise why I
> stopped doing this the last time.
>=20
> It is quite frustrating.
>=20
> paulv

Hi Paul,

The Erase method was officially added to the Window function in IDL 8.2, wh=
ich will be available in just a few weeks. In the meantime, you could inste=
ad try using the "SetData" method to simply replace the plot data. That sho=
uld actually be much faster than completely destroying the plot and recreat=
ing it.

Cheers,
Chris
ExelisVIS
0
Reply gorthmog (94) 5/1/2012 6:33:48 PM

On 5/1/12 8:32 AM, Paul van Delst wrote:
> Crikey, even the erase method doesn't work. And by "work" I mean according to:
>
>> e·rase/iˈrās/
>> Verb:	
>>      Rub out or remove (writing or marks).
>>      Remove all traces of.
>
> If I do this:
>
> IDL>  w=window()
> % Loaded DLM: XML.
> IDL>  p=plot(lindgen(100),/current)
> IDL>  w.erase
> IDL>  p=plot((findgen(100)^2)/1000.0,/current)
>
> The first plot, which I erased, reappears! ARGHHHH!
>
> Is this a known bug or a "feature"?
>
> IDL>  print, !version
> { x86 linux unix linux 8.1 Mar  9 2011      32      64}
>
> Does anyone know what is the sequence of commands to do what I would like to do? That is:
>   1) plot some data in the current window
>   2) erase the plot in the current window (data, axes, titles, everything)
>   3) plot some different data in that same, current window.
>     3a) And not have the original plot reappear.

Do you really need to erase everything?

   IDL> p = plot(findgen(100))
   IDL> p->setData, (findgen(100)^2)/1000.0

Or if you want to change a bunch of stuff at once:

   IDL> p = plot(findgen(100))
   IDL> p->refresh, /disable
   IDL> p->setData, (findgen(100)^2)/1000.0
   IDL> p.title = 'New title'
   ; ... set more properties ...
   IDL> p->refresh

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
0
Reply mgalloy (665) 5/1/2012 6:51:06 PM

On 05/01/12 14:51, Michael Galloy wrote:
> On 5/1/12 8:32 AM, Paul van Delst wrote:
>> Crikey, even the erase method doesn't work. And by "work" I mean according to:
>>
>>> e·rase/iˈrās/
>>> Verb:   
>>>      Rub out or remove (writing or marks).
>>>      Remove all traces of.
>>
>> If I do this:
>>
>> IDL>  w=window()
>> % Loaded DLM: XML.
>> IDL>  p=plot(lindgen(100),/current)
>> IDL>  w.erase
>> IDL>  p=plot((findgen(100)^2)/1000.0,/current)
>>
>> The first plot, which I erased, reappears! ARGHHHH!
>>
>> Is this a known bug or a "feature"?
>>
>> IDL>  print, !version
>> { x86 linux unix linux 8.1 Mar  9 2011      32      64}
>>
>> Does anyone know what is the sequence of commands to do what I would like to do? That is:
>>   1) plot some data in the current window
>>   2) erase the plot in the current window (data, axes, titles, everything)
>>   3) plot some different data in that same, current window.
>>     3a) And not have the original plot reappear.
> 
> Do you really need to erase everything?

If I was designing all this from the outset, no.

As a "quick" drop in replacement for a NG window into a (previously DG) widget app? Yes.

>   IDL> p = plot(findgen(100))
>   IDL> p->setData, (findgen(100)^2)/1000.0
> 
> Or if you want to change a bunch of stuff at once:
> 
>   IDL> p = plot(findgen(100))
>   IDL> p->refresh, /disable
>   IDL> p->setData, (findgen(100)^2)/1000.0
>   IDL> p.title = 'New title'
>   ; ... set more properties ...
>   IDL> p->refresh

Correct. But now do this when the graphics reference "p" is not stored between calls to the event handler that
redisplays after some other event has occurred (e.g. button press). There's nothing to reference the setData method.

It's all fixable of course with a redesign of the way the state vector and event handlers work (see
http://idldatapoint.com/2012/04/05/using-new-graphics-in-an-idl-widget-program/ where MarkP touches upon this sort of
issue). But a working erase method would have made everything work from the get go.

cheers,

paulv
0
Reply paul.vandelst (1947) 5/1/2012 7:57:44 PM

Hello,

On 05/01/12 14:33, Chris Torrence wrote:
> On Tuesday, May 1, 2012 8:48:33 AM UTC-6, Paul van Delst wrote:
>> On 05/01/12 10:27, David Fanning wrote:
>>> Paul van Delst writes:
>>> 
>>>> I've started replacing the DG draw widgets in my widget apps with NG window widgets. The way I use a particular
>>>> app was to plot different things based on a selection from a button group. In DG there's no worries - you just
>>>> call plot and the erase happens automagically and the new plot appears. But in NG the plots just pile on top of
>>>> each other. I've searched the IDL documentation for the PLOT() and WINDOW() functions but there doesn't appear
>>>> to be an "Erase" method.
>>>> 
>>>> However, when I look at the IDLgrWindow window documentation there is the Erase method listed.
>>>> 
>>>> Which does work with the window created using Window(),e.g.
>>>> 
>>>> IDL> w=window() % Loaded DLM: XML. IDL> p=plot(indgen(100),current=w) IDL> w.erase
>>>> 
>>>> So, does this mean ALL IDLgrXXXX methods work with the associated NG functions (e.g. IDLgrPlot for PLOT(),
>>>> IDLgrSurface for SURFACE() etc)?
>>>> 
>>>> And what about vice-versa?
>>> 
>>> You must be living in a perfect world!
>>> 
>>> I would say the connection between IDLgrXXXX methods and function graphics routines is "casual" at best. Maybe
>>> "haphazard" or "accidental" is a better description. Most things work right up until you are too committed to 
>>> turn back. :-)
>> 
>> Well, you know, this is probably about the sixth or seventh time where, after a period of weeks/months of doing
>> actual work, I come back to some IDL apps thinking "you know, it sure would be neat to use NG in this application".
>> And then, after a day of mucking about trying to figure out the cognitive pathways that led to the NG system, I
>> realise why I stopped doing this the last time.
>> 
>> It is quite frustrating.
>> 
>> paulv
> 
> Hi Paul,
> 
> The Erase method was officially added to the Window function in IDL 8.2, which will be available in just a few weeks.
> In the meantime, you could instead try using the "SetData" method to simply replace the plot data. That should
> actually be much faster than completely destroying the plot and recreating it.

Thanks for the info. I will alert of our IT folks to keeep an eye out for the release.

And, yes, I realise that the setdata method is better/faster but, as I pointed out in my reply to MikeG, this was a
drop-in replacement of an NG window into a DG widget app. I would have to add the NG graphics reference to the widget
state vector. As I also said, that's not a very big deal, but a working erase method would have been immediately successful.

I know, I know, I'm a crotchety bugger... but I miss those "Will this work? Yes it does!" moments. Especially after I
had one when I replaced the WIDGET_DRAW function with WIDGET_WINDOW simply by changing the name and, voila, there was my
newly created NG window in my widget app waiting for me to fill it data plots.

cheers.

paulv
0
Reply paul.vandelst (1947) 5/1/2012 8:07:56 PM

On Tuesday, May 1, 2012 2:07:56 PM UTC-6, Paul van Delst wrote:
>=20
> Thanks for the info. I will alert of our IT folks to keeep an eye out for=
 the release.
>=20
> And, yes, I realise that the setdata method is better/faster but, as I po=
inted out in my reply to MikeG, this was a
> drop-in replacement of an NG window into a DG widget app. I would have to=
 add the NG graphics reference to the widget
> state vector. As I also said, that's not a very big deal, but a working e=
rase method would have been immediately successful.
>=20
> I know, I know, I'm a crotchety bugger... but I miss those "Will this wor=
k? Yes it does!" moments. Especially after I
> had one when I replaced the WIDGET_DRAW function with WIDGET_WINDOW simpl=
y by changing the name and, voila, there was my
> newly created NG window in my widget app waiting for me to fill it data p=
lots.
>=20
> cheers.
>=20
> paulv

Hi paulv,

I totally understand your frustration. With IDL 8.2, I think we've made som=
e great strides in making things "just work" in new graphics. Examples woul=
d include: allowing array inputs for Arrow and Symbol, custom Axis ranges, =
the Erase method, a new Clip property, a new symbol font with planetary sym=
bols, a much better Colorbar, legends for vector plots, etc.

Nevertheless, I'm sure there are a lot more enhancements (and bug fixes) th=
at need to be done before we truly surpass everything that direct graphics =
can do.

Please keep giving feedback as to where you think we can improve new graphi=
cs. At this point, we've done most of the "low-hanging" fruit, and from now=
 on, we really need to rely on user input as to where you think we should g=
o.

Thanks!

-Chris
ExelisVIS
0
Reply gorthmog (94) 5/2/2012 3:03:18 PM

8 Replies
47 Views

(page loaded in 0.07 seconds)


Reply: