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

Home » Public Forums » archive » Re: David's TVSCALE
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: David's TVSCALE [message #55739] Sun, 09 September 2007 18:37 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
maye writes:

> David's TVSCALE and TVIMAGE programs nicely calculate the positions
> required for multiplots (using !p.multi), but I would like to control
> the output-size per assigned space in the multiplot window.
> Example:
> If I set
> !p.multi=[0,2,2]
> so that I have 4 subframes to fill, I would like to tell TVSCALE (or
> TVIMAGE), that it should not use the whole of that quarter window, but
> only the lower 80% or so of it, so that I have space to put a colorbar
> on top of each subframes.
> But the position keyword of TVSCALE seems to be ignored for
> multiplots?
> So how could I do it? I basically would like 4 subframes each having
> their own colorbar on top of the displayed image.

Alright, in an ongoing effort to keep TVIMAGE and TVSCALE
as the number one TV replacements in the IDL universe,
I have added the ability to do what you want to do here.

Now, if you use the POSITION keyword with either TVIMAGE
or TVSCALE, and you are displaying images with !P.MULTI,
the POSITION keyword will position the image with respect
to the "window" specified for the image by !P.MULTI. (Since
no one in their right mind would be using the POSITION
keyword and !P.MULTI together, I figure this won't affect
anyone currently using the TVIMAGE command.)

So, to put four images and associated colorbars into a
window with !P.MULTI, you would write code something
like this:

;*********************************************************
image = Dist(200)
!P.Multi=[0,2,2]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 0
TVImage, image, Position=p
Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 5
TVImage, image, Position=p
Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 2
TVImage, image, Position=p
Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 3
TVImage, image, Position=p
Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
!P.Multi = 0
;*********************************************************

You can find the updated programs here:

http://www.dfanning.com/programs/tvimage.pro
http://www.dfanning.com/programs/tvscale.pro

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: David's TVSCALE [message #55740 is a reply to message #55739] Sun, 09 September 2007 13:05 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
maye writes:

> David's TVSCALE and TVIMAGE programs nicely calculate the positions
> required for multiplots (using !p.multi), but I would like to control
> the output-size per assigned space in the multiplot window.
> Example:
> If I set
> !p.multi=[0,2,2]
> so that I have 4 subframes to fill, I would like to tell TVSCALE (or
> TVIMAGE), that it should not use the whole of that quarter window, but
> only the lower 80% or so of it, so that I have space to put a colorbar
> on top of each subframes.
> But the position keyword of TVSCALE seems to be ignored for
> multiplots?
> So how could I do it? I basically would like 4 subframes each having
> their own colorbar on top of the displayed image.

This is called wanting to have your cake and eat it, too.
Generally speaking, it is not allowed in life OR in IDL. :-)

For four frames, you could probably figure out the math you
need to draw the plots directly in your head, but if not, I
suppose you could modify TVSCALE itself. The way it is made
to work with !P.MULTI is that draws an "invisible" plot to
get the "position" coordinates where the image is suppose
to go. You could certainly change those position coordinates
to suit yourself and leave room for a colorbar that you would
insert into the code at this location, too.

I'd do it for you, except then I would have to worry about
*where* you wanted to put the darn colorbar, etc.

And, as I say, calculating the position coordinates for just
four frames seems so simple that it doesn't seem worth the
work it would take to do it.

If all the colors are the same, another alternative is one
colorbar below all the images. You could use the ![XY].OMARGIN
system variables to leave room for this color bar.

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: David's TVSCALE [message #56182 is a reply to message #55739] Thu, 04 October 2007 15:31 Go to previous message
maye is currently offline  maye
Messages: 29
Registered: June 2006
Junior Member
On Sep 10, 3:37 am, David Fanning <n...@dfanning.com> wrote:
> maye writes:
>> David's TVSCALE and TVIMAGE programs nicely calculate the positions
>> required for multiplots (using !p.multi), but I would like to control
>> the output-size per assigned space in the multiplot window.
>> Example:
>> If I set
>> !p.multi=[0,2,2]
>> so that I have 4 subframes to fill, I would like to tell TVSCALE (or
>> TVIMAGE), that it should not use the whole of that quarter window, but
>> only the lower 80% or so of it, so that I have space to put a colorbar
>> on top of each subframes.
>> But the position keyword of TVSCALE seems to be ignored for
>> multiplots?
>> So how could I do it? I basically would like 4 subframes each having
>> their own colorbar on top of the displayed image.
>
> Alright, in an ongoing effort to keep TVIMAGE and TVSCALE
> as the number one TV replacements in the IDL universe,
> I have added the ability to do what you want to do here.
>
> Now, if you use the POSITION keyword with either TVIMAGE
> or TVSCALE, and you are displaying images with !P.MULTI,
> the POSITION keyword will position the image with respect
> to the "window" specified for the image by !P.MULTI. (Since
> no one in their right mind would be using the POSITION
> keyword and !P.MULTI together, I figure this won't affect
> anyone currently using the TVIMAGE command.)
>
> So, to put four images and associated colorbars into a
> window with !P.MULTI, you would write code something
> like this:
>
> ;*********************************************************
> image = Dist(200)
> !P.Multi=[0,2,2]
> p = [0.02, 0.3, 0.98, 0.98]
> LoadCT, 0
> TVImage, image, Position=p
> Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
> p = [0.02, 0.3, 0.98, 0.98]
> LoadCT, 5
> TVImage, image, Position=p
> Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
> p = [0.02, 0.3, 0.98, 0.98]
> LoadCT, 2
> TVImage, image, Position=p
> Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
> p = [0.02, 0.3, 0.98, 0.98]
> LoadCT, 3
> TVImage, image, Position=p
> Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
> !P.Multi = 0
> ;*********************************************************
>
> You can find the updated programs here:
>
> http://www.dfanning.com/programs/tvimage.pro
> http://www.dfanning.com/programs/tvscale.pro
>
> 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.")

Great! Haven't tried it yet, was busy and on travel with the Dawn
Launch, that's why I didn't give feedback, but I'm sure you did the
right thing. ;)
As always, many thanks and I will try it the next days.
Michael
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: WINDOWS drag and drop into a draw widget
Next Topic: SetPixelData Error

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

Current Time: Sat Oct 11 20:07:45 PDT 2025

Total time taken to generate the page: 2.96052 seconds