|
|
|
|
|
Re: Title in iPlot [message #50860 is a reply to message #50859] |
Fri, 20 October 2006 07:26   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Kenneth Bowman writes:
> By the way, wouldn't it be nice if you could use the Visualization Browser or
> the Property Editor to get the ID's for all of the objects and properties? The
> Visualization Browser says the property is "Zoom factor", while the actual ID is
> "CURRENT_ZOOM". The only way I know to find these things is by fooling around
> with FindIdentifiers
>
> viz_ids = itool_obj -> FindIdentifiers('*Visualization Layer*')
> PRINT, viz_ids
Yes, this is really the most frustrating part of doing
anything with iTools. But, oddly enough, the same problem
pops up with shapefiles. I have two examples of using
shapefiles on my web page, and yet I get e-mails all the
time from people who are frustrated trying to read and
display shapefiles other than the examples I use.
I spent yesterday building a shapefile browser so you
could examine the file and entity attributes in a
shapefile before you had to try to decipher the darn
thing. It occurs to me that something very like this
could be written for iTools. In fact, the guy who
wrote it, Ken, would probably get rich. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Title in iPlot [message #50861 is a reply to message #50860] |
Fri, 20 October 2006 06:50   |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <MPG.1fa1b0da7a5a0cc9989d56@news.frii.com>,
David Fanning <news@dfanning.com> wrote:
> There must be some good reason why the Annotation Layer
> is specified in Normalize coordinates and the rest of
> the Plot stuff is in Data coordinates, but it escapes
> me right now. In any case, having the Plot title in
> normalized coordinates causes the title to bounce
> around quite a bit as you resize the window. It starts
> out just right, then it gets far away again, now it
> jumps right into the plot!
I think the answer here is "3-D plots". When I make a 3-D plot I want the text
to stay "on the glass", not rotate with the plot (and the data coordinate
system). In some cases you might want the text to rotate with the plot (a la
PLOT_3DBOX), but the downside is that the title can be impossible to read from
some viewing angles.
I'm not sure what you mean by jumping around. If I zoom the view like this,
itool_id = itGetCurrent(TOOL = itool_obj)
view_1_id = itool_obj -> FindIdentifiers('*VIEW_1')
rc = itool_obj -> DoSetProperty(view_1_id, 'CURRENT_ZOOM', 1.25)
itool_obj -> RefreshCurrentWindow
the text zooms also. I find this disconcerting, as it changes the "normalized"
coordinates, but this is the only way I can find to do this, as VIEW_1 has a
"Zoom factor" property, while the visualization layer (apparently) does not.
I suppose a possible solution is to add a second view with only an annotation
layer. That view could be left alone when the view containing the data is
zoomed.
By the way, wouldn't it be nice if you could use the Visualization Browser or
the Property Editor to get the ID's for all of the objects and properties? The
Visualization Browser says the property is "Zoom factor", while the actual ID is
"CURRENT_ZOOM". The only way I know to find these things is by fooling around
with FindIdentifiers
viz_ids = itool_obj -> FindIdentifiers('*Visualization Layer*')
PRINT, viz_ids
Ken
|
|
|
Re: Title in iPlot [message #50868 is a reply to message #50861] |
Thu, 19 October 2006 17:39   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Benjamin Hornberger writes:
> For the lazy among us, could you post some example code? I quickly tried
> to get an annotation into the visualization layer interactively and
> couldn't manage to do that. Does that only work programmatically? I was
> also annoyed by the fact that the title doesn't resize along with the plot.
Is it YOU sending me those e-mails under an assumed
name, Benjamin?
Here is the code I used. Almost verbatim from
the aforementioned Tech Tip:
tool = itGetCurrent(tool=oTool)
;get an object descriptor for the text annotation class:
oDesc = oTool->GetAnnotation('Text')
;initialize an object reference for a new text annotation:
oText = oDesc->GetObjectInstance()
;set the properties on the text annotation object:
oText->SetProperty, _STRING=title_text, _HORIZONTAL_ALIGN=1, $
LOCATIONS=[6,330,0.99]
;add the text object to the annotation layer:
oTool->Add, oText, LAYER='VISUALIZATION LAYER'
The LOCATIONS obviously are in your data coordinate system
units.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
|
Re: Title in iPlot [message #50871 is a reply to message #50870] |
Thu, 19 October 2006 15:57   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Kenneth Bowman writes:
> gtitle = 'This is the Title'
> idAnnotate = itool_obj -> FindIdentifiers('*/ANNOTATION LAYER')
> oAnnotate = itool_obj -> getByIdentifier(idAnnotate)
> oAnnotate -> add, OBJ_NEW('IDLitVisText', _STRING = gtitle, $
> ALIGNMENT = 0.5, $
> VERTICAL_ALIGNMENT = 1.0, $
> FONT_SIZE = 24, $
> LOCATION = [0.0, 0.70, 0.99])
There must be some good reason why the Annotation Layer
is specified in Normalize coordinates and the rest of
the Plot stuff is in Data coordinates, but it escapes
me right now. In any case, having the Plot title in
normalized coordinates causes the title to bounce
around quite a bit as you resize the window. It starts
out just right, then it gets far away again, now it
jumps right into the plot!
Is there a way to put the title in the Visualization
layer so I can specify its location in data coordinates?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Title in iPlot [message #50872 is a reply to message #50871] |
Thu, 19 October 2006 15:32   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Benjamin Hornberger writes:
> http://tinyurl.com/y3anut or
> http://www.ittvis.com/codebank/search.asp?FID=308 describe how to insert
> the title programmatically (before the keyword VIEW_TITLE was
> introduced). By playing with the coordinates, you should get it to where
> you want it.
We were using VIEW_TITLE and we couldn't help noticing
that the title was, well, just about the next county
over from the thing it was suppose to be attached to.
Close enough for government work, I guess, but the
journal editor wasn't too pleased with the gestalt.
(We pointed out, by the way, that you could just
drag the title and put if where you wanted it if it
bothered you so damn much, but we didn't get very
far with that line of argument.)
Anyway, solved now, thank you.
Cheers,
David
P.S. I sure hope Ken is working on his next book. Adding a
title to a plot seems like the kind of thing you might
want to do now and then. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: Title in iPlot [message #50874 is a reply to message #50873] |
Thu, 19 October 2006 15:12   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Kenneth Bowman writes:
>
> I can't find any iTools tutorial (this may be from the tutorial,
> but memory fades), but I have been doing something like this:
>
> gtitle = 'This is the Title'
> idAnnotate = itool_obj -> FindIdentifiers('*/ANNOTATION LAYER')
> oAnnotate = itool_obj -> getByIdentifier(idAnnotate)
> oAnnotate -> add, OBJ_NEW('IDLitVisText', _STRING = gtitle, $
> ALIGNMENT = 0.5, $
> VERTICAL_ALIGNMENT = 1.0, $
> FONT_SIZE = 24, $
> LOCATION = [0.0, 0.70, 0.99])
Right. I just found a Tech Tip about this that I managed
to get working:
http://www.ittvis.com/codebank/search.asp?FID=308
Thanks,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Title in iPlot [message #50875 is a reply to message #50874] |
Thu, 19 October 2006 14:48   |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <MPG.1fa19ebe20226094989d53@news.frii.com>,
David Fanning <news@dfanning.com> wrote:
> Folks,
>
> Did anyone do the iTools tutorial? Do you know how to
> get the plot title closer to the plot programmatically?
> Ours is about 5 feet away. :-(
>
> Thanks,
>
> David
I can't find any iTools tutorial (this may be from the tutorial,
but memory fades), but I have been doing something like this:
gtitle = 'This is the Title'
idAnnotate = itool_obj -> FindIdentifiers('*/ANNOTATION LAYER')
oAnnotate = itool_obj -> getByIdentifier(idAnnotate)
oAnnotate -> add, OBJ_NEW('IDLitVisText', _STRING = gtitle, $
ALIGNMENT = 0.5, $
VERTICAL_ALIGNMENT = 1.0, $
FONT_SIZE = 24, $
LOCATION = [0.0, 0.70, 0.99])
Ken Bowman
|
|
|
Re: Title in iPlot [message #51125 is a reply to message #50873] |
Sat, 28 October 2006 10:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Benjamin Hornberger writes:
> David Fanning wrote:
>> Did anyone do the iTools tutorial? Do you know how to
>> get the plot title closer to the plot programmatically?
>> Ours is about 5 feet away. :-(
>
> http://tinyurl.com/y3anut or
> http://www.ittvis.com/codebank/search.asp?FID=308 describe how to insert
> the title programmatically (before the keyword VIEW_TITLE was
> introduced). By playing with the coordinates, you should get it to where
> you want it.
>
> Sounds quite complicated at first, but along with the documentation
> (Appendix A in the iTools developer's guide) one can understand it
> eventually.
>
> If you want to move an existing annotation programmatically, you somehow
> have to retrieve that annotation's identifier and modify its properties
> (coordinates). Don't ask me the details, but the iTools developer's
> guide talks about that as well.
As a follow-up to this, I thought I might write a short
article about how to insert a title into the VISUALIZATION
layer, rather than the ANNOTATION layer, so that the title
would move appropriately with the plot itself. I had done
this empirically, but I wanted to know how to do it
programmatically.
To do so, I need to know what in direct graphics
would be ![XY].CRANGE. The essential problem is how do
I extract that kind of information from an iTool plot.
I found an article on the ITT Tech Tip web page that
looked promising:
http://www.ittvis.com/services/techtip.asp?ttid=3812
The title of the article is "In iTools Synchronizing
Annotation Layer Movement With Visualization Layer
Movement". Just what I want to do. The article comes
with 9 pages (!) of heavily annotated IDL code that
explains how this is done. Interesting reading.
Unfortunately, when you get to the end of all that
typing, the darn thing doesn't work. Doesn't come
close to working, as far as I can tell. The colorbar
doesn't even line up with the axes, let alone move
with it. And it doesn't matter if I type the commands,
or I use the very helpful code that can be downloaded
from the tip page. Alas, NOTHING works!
Does anyone have any idea how I might be able to
do something like this?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|