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

Home » Public Forums » archive » Re: Plotting a Text Box below a plot so that also works when !P.MULTI is set.
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: Plotting a Text Box below a plot so that also works when !P.MULTI is set. [message #13615] Mon, 23 November 1998 00:00
David L. Windt is currently offline  David L. Windt
Messages: 9
Registered: June 1997
Junior Member
Have a look at my plot_text program, which allows you to position text
underneath a plot (or inside a plot). For example, try this:

!p.multi=[0,1,2]
plot,[1,2],ymargin=[10,2]
plot_text,['Some text','Some more text'],position=1
plot,[1,2]

You can also use my legend program to position a plot legend the same
way.

The plot_text and legend procedures are part of the 'windt library',
available at http://www.bell-labs.com/user/windt/idl

-David Windt
Re: Plotting a Text Box below a plot so that also works when !P.MULTI is set. [message #13624 is a reply to message #13615] Sun, 22 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Martin Schultz (mgs@io.harvard.edu) writes:

> Hey David!
>
> Wasn't it you yourself who told me about !x.window and !y.window which store
> the size of the current plot window? As a first try you could position your
> text with something like
> px = (!x.window[0]+!x.window[1])/2.
> py = !y.window[0]
> xyouts,px,py,yourtext,/norm,align=0.5
> and if you use the !x.margin and !y.margin keywords, you may even be able to
> prevent the plot and the text box from running into each other.

All true, but NOT, I think, with !P.Multi. For one thing, the
!X.Window parameters are not set until *after* the plot is
made. It would be possible, probably, to use !P.Multi to do
some of the nasty calculating for you. Especially with respect
to calculating the proper character size, etc. for the plots.
I did something similar with a complicated plot object I
created some time ago that had to plot itself into a window
grid. But the actual plots were drawn with the parameters
that I got from !P.Multi, not by using it directly.

> The beauty of !p.multi is that you can easily specify the number of rows and
> columns without having to go through these non-trivial calculations of the
> position parameter. I don't think one should drop this too fast.

!P.Multi is beautiful. In fact, more beautiful and useful than
most people realize. But I still think it is not the correct
choice for this particular application.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Plotting a Text Box below a plot so that also works when !P.MULTI is set. [message #13630 is a reply to message #13624] Sun, 22 November 1998 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
David Fanning wrote:

> Axel Schweiger (axel@apl.washington.edu) writes:
>
>> I want to plot a box containing text below an existing plot which
>> contains a graphic. I want this to work also when !P.multi is set.
>>
>> I have played around a bit with the POSITION parameter but that doesn't
>> seem to work when used with !P.MULTI. The Margins are another option. I
>> probably
>> could figure this out but somebody probably has already.
>
> I think you may have to give up on !P.Multi in this case,
> unless you are really, really clever (and even then I'm not
> sure you could do it or that it would be worth the effort).
> I think it would be much easier to just position the plots
> in the window yourself. Subsequent plots can be drawn into
> the window with the NOErase keyword.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Progamming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155

Hey David!

Wasn't it you yourself who told me about !x.window and !y.window which store
the size of the current plot window? As a first try you could position your
text with something like
px = (!x.window[0]+!x.window[1])/2.
py = !y.window[0]
xyouts,px,py,yourtext,/norm,align=0.5
and if you use the !x.margin and !y.margin keywords, you may even be able to
prevent the plot and the text box from running into each other.
The beauty of !p.multi is that you can easily specify the number of rows and
columns without having to go through these non-trivial calculations of the
position parameter. I don't think one should drop this too fast.

Regards,
Martin.


--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
Re: Plotting a Text Box below a plot so that also works when !P.MULTI is set. [message #13642 is a reply to message #13624] Fri, 20 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Axel Schweiger (axel@apl.washington.edu) writes:

> I want to plot a box containing text below an existing plot which
> contains a graphic. I want this to work also when !P.multi is set.
>
> I have played around a bit with the POSITION parameter but that doesn't
> seem to work when used with !P.MULTI. The Margins are another option. I
> probably
> could figure this out but somebody probably has already.

I think you may have to give up on !P.Multi in this case,
unless you are really, really clever (and even then I'm not
sure you could do it or that it would be worth the effort).
I think it would be much easier to just position the plots
in the window yourself. Subsequent plots can be drawn into
the window with the NOErase keyword.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PV-Wave: Linux Installation Problem
Next Topic: thanks to IDL I can program this now ...

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

Current Time: Wed Oct 08 17:37:03 PDT 2025

Total time taken to generate the page: 0.00487 seconds