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

Home » Public Forums » archive » Re: !p.multi question: margin possible at top of page?
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: !p.multi question: margin possible at top of page? [message #1881] Mon, 21 March 1994 23:37
stl is currently offline  stl
Messages: 70
Registered: February 1994
Member
I wrote a while back..
>> I am trying to find out if anyone has succesfully been able to create a
>> margin at the top of a page while !p.multi is being used.
>
Thanks for all the responses. Let me sumarize what I ended up doing, so
other people can try this too. First of all, yes, we only needed to
look at the output in postscript. Thats good, because the margins when
using !p.multi (on a page) are pretty big. I wrote a little title_plot
program that puts the a plot pretty centered and on the top of the page,
with parameters to move in the x and y direction (in character units).
Instead of leaving on the page (the title) I pushed it up off the page!
You cannot see it on the display screen, but in the postscript plot it
works well. Likewise we put a legend and the date stamp below the
bottom of the page (in the lower margin!) Note, to do this, create the
plot first, then put the stuff in the margins.
To view this on the screen, we used ghost script as follows:
gs -g600x800 -r70 filename
This is on a sparc 10 runing Solaris 1.0.something.

If anyone would like this code, or more information, just let me
know...

thanks for all your help, and I too hope this makes it onto the 'to
be changed list at RSI'

-stephen Strebel
--
Stephen C Strebel / SKI TO DIE
stl@maz.sma.ch / and
Swiss Meteorological Institute, Zuerich / LIVE TO TELL ABOUT IT
01 256 93 85 / (and pray for snow)
Re: !p.multi question: margin possible at top of page? [message #1886 is a reply to message #1881] Mon, 21 March 1994 05:36 Go to previous message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <18MAR199418225138@nssdca.gsfc.nasa.gov> candey@nssdca.gsfc.nasa.gov (Bob Candey) writes:
> I don't understand why this is no longer in the IDL manuals. There is a
> !x(y).margin to set the left(top) and right(bottom) margins of each panel
> (in units of characters). In addition, there is !x(y).omargin to set
> the outside margins for the whole page. This works with !p.multi.
>
> -----
> Bob Candey NSSDCA::CANDEY
> NASA Goddard Space Flight Center, Code 632 candey@nssdca.gsfc.nasa.gov
> Greenbelt, MD 20771 USA 1-301-286-6707

Bob,

Thanks a lot! This !x(y).omargin is definitely the way to go, since
most applications want extra room for text and the omargin has character cells
as its units. This is especially nice since it then scales with any change in
the !p.charsize. It is still pretty easy then to make room for a color bar as
long as it is assigned a height or width based on the charcter size (ie. make
the color bar 2 characters wide).

I also agree that the manuals could use a section which summarizes the
contents and use of each of the fields in the !x(y(z)) system structures. As
it is now it is done implicitly in the discussion of keywords.

What a way to start the week!


--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: zawodny@arbd0.larc.nasa.gov MS-475, Hampton VA, 23681-0001
Packet: ko4lw@n4hog.va.usa
Re: !p.multi question: margin possible at top of page? [message #1887 is a reply to message #1886] Fri, 18 March 1994 14:22 Go to previous message
candey is currently offline  candey
Messages: 6
Registered: March 1994
Junior Member
I don't understand why this is no longer in the IDL manuals. There is a
!x(y).margin to set the left(top) and right(bottom) margins of each panel
(in units of characters). In addition, there is !x(y).omargin to set
the outside margins for the whole page. This works with !p.multi.

-----
Bob Candey NSSDCA::CANDEY
NASA Goddard Space Flight Center, Code 632 candey@nssdca.gsfc.nasa.gov
Greenbelt, MD 20771 USA 1-301-286-6707
Re: !p.multi question: margin possible at top of page? [message #1889 is a reply to message #1887] Fri, 18 March 1994 11:11 Go to previous message
schmitt is currently offline  schmitt
Messages: 3
Registered: December 1993
Junior Member
> I am trying to find out if anyone has succesfully been able to create a
> margin at the top of a page while !p.multi is being used.

There's one way of doing this, if two conditions are satisfied:
1.) You're only worried about output in postscript form.
2.) You don't mind a KLUGE.
It takes advantage of the (surmised) fact that the margins IDL uses for
postscript output are a bit sloppy, and there's room at the top above
all of the plots.
The kluge:
After plotting all of the needed plots on a page with !p.multi, execute
this bit of code to put a title contained in the string title$ above
the page
...
pmh = !p.multi
!noeras=1
!p.multi=0; reset plots/page
xyouts,0.,1.,title$,/norm
!noeras=0
!p.multi=pmh
...
(I don't even know if !noeras is a recommended system variable anymore,
it may not even be needed.)
This essentially redefines the page as a single plot (1 plot/page), and
puts the text string at the (normalized) position x=0, y=1. Since this
is the position of the LOWER left hand corner of the text string, the
string is plotted above the page. Using this with a tektronix terminal
emulator gives just the bottom edge of the text over the plots, but it
appears to print fine with postscript output (landscape, at least).
YMMV. ONVWPBL.

Obviously, it would really be handy for IDL to have an internal way of
doing it, and I strongly urge RSI to put this feature in. Right after
they fix the bugs in contour.

-----------------------------------------------------------
Andy Schmitt schmitt@this.nrl.navy.mil
Code 6730 : Naval Research Lab : Washington DC : 20375-5346
Re: !p.multi question: margin possible at top of page? [message #1891 is a reply to message #1889] Fri, 18 March 1994 07:21 Go to previous message
pcp2g is currently offline  pcp2g
Messages: 3
Registered: July 1991
Junior Member
In article <2mc3vlINNa2v@i32.sma.ch>, stl@sma.ch (Stephen Strebel) writes:
|> hello,
|>
|> I am trying to find out if anyone has succesfully been able to create a
|> margin at the top of a page while !p.multi is being used.
|> My scenario is that I have multiple plots on the page, and I want to
|> xyout a title to the top of the page. No problem, but each plots has
|> titles etc and I cannot figure out how to get !p.multi to leave x number
|> of pixels margin on the top of the page.
|>
|> -stephen

I had this problem recently. I had four plots I wanted on a page,
stacked 2X2, with individual tick marks. Hwowever, I only wanted
a single x and y title. A friend of mine and I worked out a
solution: plot the 4 2X2 plots, then OVERPLOT an empty plot
with the dimensions of the 2X2 stack. This large frame then
can be used to get the x and y titles. In other words,
if each of my plots is, say, 100X100, then the ganged plot
is 200X200. Then make a 200X200 empty plot, and overplot it.
Then when you use x and ytitle, it works for the bigger frame.
This can also help adjust the margins; I'll explain below.
Here is the procedure:

>> !p.multi=[0,2,2,2] ; makes a 2X2 ganged plot. The last "2" means
another plot will be layed over the existing 2x2
gang.
>> set_viewport,0.2,0.5,0.5,0.8
;this will place the first plot in the upper left (UL) side
of the 2x2 gang. The set_viewport literally sizes the plots
to fit in your window. The example I use here starts horizontally
at .2 of the way in from the left side of the graph and ends
.5 of the way in. It starts vertically .5 of the window from
the bottom and ends 0.8 of the window up from the bottom.

>> plot,x1,y1 ; make the plot

>> set_viewport,0.5,0.8,0.5,0.8 ; plot graph #2 in the UR side of the gang.
>> plot,x2,y2

>> set_viewport,0.5,0.8,0.2,0.5 ; plot #3 in the LR space
>> plot,x3,y3

>> set_viewport,0.2,0.5,0.2,0.5 ; plot #4 in the LL side
>> plot,x4,y4

Now you have the actual graphs for the figure. Now you have to
set up the frame.

>> set_viewport,0.2,0.8,0.2,0.8 ; sets the frame to be the size of the
entire 2X2 array
>> ya=fltarr(2,2) & ya(0,0)=0 & ya(0,1)=0 & ya(1,0)=0 & ya(1,1)=0
;make a dummy array to plot.

>> !x.ticks=1 & !y.ticks=1
>> !x.tickname=[' ',' '] & !y.tickname=[' ',' ']
;set the tick marks so you don't overwrite the 'real'
tickmarks of the 2X2 gang.
>> plot,ya,xtitle='Here is my x axis',$
>> ytitle='And here is my y axis'

This should work. You now have a 2X2 plot with the xtitle
stretching across both plots, and the same for the yaxis.
The tick marks may get a bit screwed up; the
ticks from the frame may still get printed in between the
real tick marks for your ganged plots. I cannot seem to find
a solution for that. Fool around with the !x.ticks and
!x.tickname arrays and see if you can fix it. If you can, post it!

To make a different margin, simply use different values for
the set_viewport command. Make the whole thing 0.3,0.7,0.3,0.7
to get a much bigger margin. Also, to put the xtitle at the top of the
page, use xyouts with the frame as a reference.

Hope this helps.

--
* Phil Plait pcp2g@virginia.edu
* Baby Member (by 1.83 years), STOFF
* "To escape from our own island, we must each metaphorically
* kill our own Gilligan..."
Re: !p.multi question: margin possible at top of page? [message #1892 is a reply to message #1891] Fri, 18 March 1994 04:35 Go to previous message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <2mc3vlINNa2v@i32.sma.ch> stl@sma.ch (Stephen Strebel) writes:
>
> I am trying to find out if anyone has succesfully been able to create a
> margin at the top of a page while !p.multi is being used.

I and a number of fellow workers here have sought a solution to this
problem as well. There is a brute force way of creating margins by changing
the values in !y.margin as your plotting proceeds row by row, but this is very
tedious and very much trial by error. Another way is to use an entire row or
column of plots as a blank region by having !p.multi start the first plot inm
the second row. I have not tried this, but if there was a way to fool IDL into
thinking that the paper (or window) was larger than it actually was you could
have some control over how much of the first row of plots was actually visible.

What I would propose as an ultimate solution to the folks at RSI is to
utilize the values in !p.position as a window in which !p.multi takes effect.
As it is now if !p.multi is non-zero then !p.position is ignored (at least this
was true a while back and I have not tested it recently). Placement and sizing
of the individual plots could still be controlled by !x(y).margin. An example
of why we would like to do this would be to place a color bar at the bottom (or
side) of a multi panel image.

As it is now, there is not an easy (natural) way to get around these
limitations (that I know of).


--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: zawodny@arbd0.larc.nasa.gov MS-475, Hampton VA, 23681-0001
Packet: ko4lw@n4hog.va.usa
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL and MacX
Next Topic: thanks for the !x.omargin info!!

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

Current Time: Wed Oct 08 15:32:59 PDT 2025

Total time taken to generate the page: 0.00639 seconds