Re: Adding an annotation to an iTool programmatically [message #44229] |
Wed, 25 May 2005 14:45  |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Randall Skelton wrote:
> You can get at what you want with the following:
>
> iPlot, findgen(10), findgen(10)^2
>
> idTool = itGetCurrent(TOOL=oTool)
>
> idAnnotate = oTool->FindIdentifiers('*/ANNOTATION LAYER')
>
> oAnnotate = oTool->getByIdentifier(idAnnotate)
>
> oAnnotate -> add, obj_new('IDLitVisText', _STRING='I wish there were a
> manual that described this', ALIGNMENT=0.5, VERTICAL_ALIGNMENT=0.5,
> FONT_SIZE=14, LOCATION=[0.5,0.8])
>
> Note that the annotation layer uses normalized coordinates while the
> visualization layer will use data coordinates. This means if you want
> to add titles, legends or other floating objects, use the annotation
> layer but if you want to output things that depend on the data (i.e.
> print formatted text corrisponding to the x,y values for every 10th
> data point) then you may be best to add IDLitVisText objects directly
> to the visualization layer.
>
> The above represents a general way of scripting iTools in that you
> first locate the identifier from the tree with FindIdentifiers and then
> either use a DoAction/DoSetProperty operation or grab the relevent
> object. Beyond using the IDs and then finding the object, below are a
> few other 'useful' commands that may be of use in your journey:
>
> oWin = oTool->GetCurrentWindow()
> oView = oWin->GetCurrentView()
> oVisLay = oView->GetCurrentLayer()
>
> You may want to poke around in:
>
> $IDL_DIR/lib/itools/framework
> $IDL_DIR/lib/itools/component
>
> The above points to where the real documentation is ;)
>
> Cheers,
> Randall
>
Oh dear. I was already afraid that it wouldn't be just simple. But
thanks, I'll play with it.
Benjamin
|
|
|
Re: Adding an annotation to an iTool programmatically [message #44230 is a reply to message #44229] |
Wed, 25 May 2005 14:40   |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Ben Tupper wrote:
> Benjamin Hornberger wrote:
>
>> Hi all,
>>
>> the question below was posted by Mark Rivers on Nov 5, 2003, with no
>> replies. I also want to add a plot title programmatically, so can
>> anybody help by now? I am also backing the request for a keyword to
>> add a title!
>
>
> Perhaps you want VIEW_TITLE?
>
> iplot, findgen(100), name='Plot A',view_title = 'View A'
>
> Ben
I can't find a keyword VIEW_TITLE for iPlot. There's a TITLE keyword,
but that shows up only in the title bar of the window. There's a NAME
keyword ("name for this visualization"), but I'm not sure what it is
used for.
Thanks anyway :-)
Benjamin
|
|
|
|
Re: Adding an annotation to an iTool programmatically [message #44232 is a reply to message #44231] |
Wed, 25 May 2005 14:16   |
Randall Skelton
Messages: 31 Registered: October 2004
|
Member |
|
|
You can get at what you want with the following:
iPlot, findgen(10), findgen(10)^2
idTool = itGetCurrent(TOOL=oTool)
idAnnotate = oTool->FindIdentifiers('*/ANNOTATION LAYER')
oAnnotate = oTool->getByIdentifier(idAnnotate)
oAnnotate -> add, obj_new('IDLitVisText', _STRING='I wish there were a
manual that described this', ALIGNMENT=0.5, VERTICAL_ALIGNMENT=0.5,
FONT_SIZE=14, LOCATION=[0.5,0.8])
Note that the annotation layer uses normalized coordinates while the
visualization layer will use data coordinates. This means if you want
to add titles, legends or other floating objects, use the annotation
layer but if you want to output things that depend on the data (i.e.
print formatted text corrisponding to the x,y values for every 10th
data point) then you may be best to add IDLitVisText objects directly
to the visualization layer.
The above represents a general way of scripting iTools in that you
first locate the identifier from the tree with FindIdentifiers and then
either use a DoAction/DoSetProperty operation or grab the relevent
object. Beyond using the IDs and then finding the object, below are a
few other 'useful' commands that may be of use in your journey:
oWin = oTool->GetCurrentWindow()
oView = oWin->GetCurrentView()
oVisLay = oView->GetCurrentLayer()
You may want to poke around in:
$IDL_DIR/lib/itools/framework
$IDL_DIR/lib/itools/component
The above points to where the real documentation is ;)
Cheers,
Randall
|
|
|
|