iTools colorbar [message #60085] |
Thu, 01 May 2008 16:42  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
I am making an iTools plot and need to add a colorbar to an existing iTool.
I am doing it this way:
IPLOT, [0.0, 1.0], [0.0, 1.0], [0.0, 1.0], OVERPLOT = itool_id, /HIDE, $
/INSERT_COLORBAR, RGB_TABLE = rgb_table
colorbar_id = itool_obj -> FindIdentifiers('*COLORBAR', /ANNOTATION)
colorbar_obj = itool_obj -> GetByIdentifier(colorbar_id[0])
colorbar_obj -> SetProperty, ORIENTATION = 1, $
BORDER = 1, $
TITLE = 'Ozone (ppbv)', $
MAJOR = 5, $
MINOR = 1
itool_obj -> RefreshCurrentWindow
The color bar appears, and I can successfully change some
properties (orientation, number of ticks, add a border), but
am unable to change others (title, tick labels, size and
position of colorbar).
If I use the DIMENSIONS keyword, it changes the size of the
colorbar image, but not the border and annotation.
I could do it interactively, but that means that no two plots would
ever have the same color bar in the same place. Plus it gets old
after a few hundred plots. :-(
I have looked at the IDLgrColorbar properties, and the properties
that can be edited interactively in the iTool, but I am stumped.
Can anyone tell me how to change a colorbar's title, labels,
position, and size?
Ken Bowman
|
|
|
Re: iTools colorbar [message #60190 is a reply to message #60085] |
Mon, 05 May 2008 11:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Kenneth P. Bowman writes:
> There has to be a way to do this. The question does not apply only to
> colorbars. What if I want to put an institutional logo in the
> annotation layer of my iTools graphic? How do I do that?
When I began my own iTool odyssey I decided to do something
much simpler. I think I wanted to change the colors in a
image in less than the required 12 keystrokes, or
something like that. Anyway, I invested about three weeks
of solid effort and I hadn't made any headway at all,
except to reach the conclusion that whatever it was
I wanted to do just simply couldn't be done, given the
information at my disposal.
Sure enough, after complaining bitterly to a friend of
mine about the journey, my friend let me know about a secret
decoder ring known only to the insiders at ITTVIS. That's the
day I gave up on iTools, and I haven't had cause to regret
that decision from that day to this.
I don't believe we (and I mean you, me, and the rest of the
world outside of ITTVIS) are *meant* to program these things.
We are meant to appreciate the complexity, power and beauty
of them.
Cheers,
David
P.S. I know irony is difficult to convey in a multi-cultural
newsgroup like this one, but I am hoping there is no
missing it here. :-)
--
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: iTools colorbar [message #60194 is a reply to message #60085] |
Mon, 05 May 2008 07:13  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article
<7094342c-12c0-43dd-a7cd-5013c9095075@c58g2000hsc.googlegroups.com>,
"sdettrick@gmail.com" <sdettrick@gmail.com> wrote:
> IPLOT, [0.0, 1.0], [0.0, 1.0], [0.0, 1.0], OVERPLOT = itool_id, /HIDE, $
> /INSERT_COLORBAR, RGB_TABLE = rgb_table
> colorbar_id = itool_obj -> FindIdentifiers('*COLORBAR', /ANNOTATION)
> colorbar_obj = itool_obj -> GetByIdentifier(colorbar_id[0])
> colorbar_obj -> SetProperty, ORIENTATION = 1, $
> BORDER = 1, $
> TITLE = 'Ozone (ppbv)', $
> MAJOR = 5, $
> MINOR = 1
> itool_obj -> RefreshCurrentWindow
> By the way there is a bug in vertical colorbar plots which can be
> fixed by hand - in idlitviscolorbar__define.pro, change the line:
>
> data = currentorientation ? BINDGEN(2,256) : BINDGEN(256,2)
>
> to:
>
> data = currentorientation ? TRANSPOSE(BINDGEN(256,2)) :
> BINDGEN(256,2)
>
> (Thanks to James Jones, ITT engineer, for that fix).
>
> Cheers,
> Sean
Thanks for the suggestion, but ...
I originally started out to use the colorbar features built into
the iTools, but I soon discovered that it is intended for indexed
color plots. That is, the colorbar must contain 256 entries. I
haven't made indexed color plots in years (and don't intend to go
back there now), and my colorbars never have 256 entries.
I know that with some effort I could scale them, but that seems to
defeat the purpose of 24-bit color.
So my current solution (you might find this amusing), is to open
a small direct graphics window and draw the colorbar there. Of course,
the colorbar does not appear in any saved graphics files.
There has to be a way to do this. The question does not apply only to
colorbars. What if I want to put an institutional logo in the
annotation layer of my iTools graphic? How do I do that?
Ken
|
|
|
Re: iTools colorbar [message #60211 is a reply to message #60085] |
Mon, 05 May 2008 01:53  |
sdettrick@gmail.com
Messages: 5 Registered: February 2007
|
Junior Member |
|
|
Kenneth P. Bowman wrote:
> I am making an iTools plot and need to add a colorbar to an existing iTool.
>
> I am doing it this way:
>
> IPLOT, [0.0, 1.0], [0.0, 1.0], [0.0, 1.0], OVERPLOT = itool_id, /HIDE, $
> /INSERT_COLORBAR, RGB_TABLE = rgb_table
> colorbar_id = itool_obj -> FindIdentifiers('*COLORBAR', /ANNOTATION)
> colorbar_obj = itool_obj -> GetByIdentifier(colorbar_id[0])
> colorbar_obj -> SetProperty, ORIENTATION = 1, $
> BORDER = 1, $
> TITLE = 'Ozone (ppbv)', $
> MAJOR = 5, $
> MINOR = 1
> itool_obj -> RefreshCurrentWindow
>
>
> The color bar appears, and I can successfully change some
> properties (orientation, number of ticks, add a border), but
> am unable to change others (title, tick labels, size and
> position of colorbar).
>
> If I use the DIMENSIONS keyword, it changes the size of the
> colorbar image, but not the border and annotation.
>
> I could do it interactively, but that means that no two plots would
> ever have the same color bar in the same place. Plus it gets old
> after a few hundred plots. :-(
>
> I have looked at the IDLgrColorbar properties, and the properties
> that can be edited interactively in the iTool, but I am stumped.
>
> Can anyone tell me how to change a colorbar's title, labels,
> position, and size?
>
> Ken Bowman
I also needed to do a few hundred plots with the same colorbar (for a
movie) but found that it was enough to arrange the first frame of
plots using the mouse, and then create each subsequent plot by simply
using the SetData methods of the dataset for each iplot. This worked
all in one IDL session, but I suspect it is also possible to do it
across multiple IDL sessions using save/restore of the iTool
objects...
If that doesn't pan out, then to do things fully programmatically, I
would suggest that you create your plot, then set a breakpoint in
every iTools colorbar method, then modify the colorbar properties/
position via the mouse. Navigating up and down the stack when the
breakpoints are triggered should give you the info you need to do the
same thing programmatically. This MO has so far worked for me.
By the way there is a bug in vertical colorbar plots which can be
fixed by hand - in idlitviscolorbar__define.pro, change the line:
data = currentorientation ? BINDGEN(2,256) : BINDGEN(256,2)
to:
data = currentorientation ? TRANSPOSE(BINDGEN(256,2)) :
BINDGEN(256,2)
(Thanks to James Jones, ITT engineer, for that fix).
Cheers,
Sean
|
|
|