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 
Return to the default flat view Create a new topic Submit Reply
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 messageGo 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..."
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL and MacX
Next Topic: thanks for the !x.omargin info!!

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

Current Time: Thu Oct 16 23:41:00 PDT 2025

Total time taken to generate the page: 4.71886 seconds