[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Waldhäuser Str. 64, D-72076 Tübingen, Germany
[Uni logo]


MULTIPLOT Source code in multiplot.pro

MULTIPLOT

Name
       MULTIPLOT
Purpose
       Create multiple plots with shared axes.
Explanation
       This procedure makes a matrix of plots with *SHARED AXES*, either using
       parameters passed to multiplot or !p.multi in a non-standard way.
       It is good for data with one or two shared axes and retains all the
       versatility of the plot commands (e.g. all keywords and log scaling).
       The plots are connected with the shared axes, which saves space by
       omitting redundant ticklabels and titles.  Multiplot does this by
       setting !p.position, !x.tickname and !y.tickname automatically.
       A call (multiplot,/reset) restores original values.
       Note: This method may be superseded by future improvements in !p.multi
       by RSI.  For now, it's a good way to gang plots together.
Calling Sequence
       multiplot[pmulti][,/help][,/initialize][,/reset][,/rowmajor]
Example
       multiplot,/help                 ; print this header.
       ; Then copy & paste, from your xterm, the following lines to test:
       x = findgen(100)                ;          MULTIPLOT
       t=exp(-(x-50)^2/300)            ;        -------------------------
       erase                           ;        |           |           |
       u=exp(-x/30)                    ;        |           |           |
       y = sin(x)                      ;        |  UL plot  |  UR plot  |
       r = reverse(y*u)                ;        |           |           |
       !p.multi=[0,2,2,0,0]            ;        |           |           |
       multiplot                       ;       y-------------------------
       plot,x,y*u,title='MULTIPLOT'    ;       l|           |           |
       multiplot & plot,x,r            ;       a|           |           |
       multiplot                       ;       b|  LL plot  |  LR plot  |
       plot,x,y*t,ytit='ylabels'       ;       e|           |           |
       multiplot                       ;       l|           |           |
       plot,x,y*t,xtit='xlabels'       ;       s-------------------------
       multiplot,/reset                ;                       xlabels
       wait,2 & erase                  ;                TEST
       multiplot,[1,3]                 ;       H------------------------
       plot,x,y*u,title='TEST'         ;       E|      plot #1         |
       multiplot                       ;       I------------------------
       plot,x,y*t,ytit='HEIGHT'        ;       G|      plot #2         |
       multiplot                       ;       H------------------------
       plot,x,r,xtit='PHASE'           ;       T|      plot #3         |
       multiplot,/reset                ;        ------------------------
                                       ;                PHASE
       multiplot,[1,1],/init,/verbose  ; one way to return to single plot
       % MULTIPLOT: Initialized for 1x1, plotted across then down (column major).
Optional Input Parameters
       pmulti = 2-element or 5-element vector giving number of plots, e.g.,
         multiplot,[1,6]               ; 6 plots vertically
         multiplot,[0,4,2,0,0]         ; 4 plots along x and 2 along y
         multiplot,[0,4,2,0,1]         ; ditto, except rowmajor (down 1st)
         multiplot,[4,2],/rowmajor     ; identical to previous line
Keyword Parameters
       help = flag to print header
       initialize = flag to begin only---no plotting, just setup,
         e.g., multiplot,[4,2],/init,/verbose & multiplot & plot,x,y
       reset = flag to reset system variables to values prior to /init
       default = flag to restore IDL's default value for system variables
       rowmajor = flag to number plots down column first (D=columnmajor)
       verbose = flag to output informational messages
Output Parameters
       !p.position = 4-element vector to place a plot
       !x.tickname = either '' or else 30 ' ' to suppress ticknames
       !y.tickname = either '' or else 30 ' ' to suppress ticknames
       !p.noerase = 1
Common Blocks
       multiplot---to hold saved variables and plot counter.  See code.
Side Effects
       Multiplot sets a number of system variables: !p.position, !p.multi,
       !x.tickname, !y.tickname, !P.noerase---but all can be reset with
       the call: multiplot,/reset
Restrictions
       1. If you use !p.multi as the method of telling how many plots
       are present, you have to set !p.multi at the beginning each time you
       use multiplot or call multiplot with the /reset keyword.
       2. There's no way to make an xtitle or ytitle span more than one plot,
       except by adding spaces to shift it or to add it manually with xyouts.
       3. There is no way to make plots of different sizes; each plot
       covers the same area on the screen or paper.
Procedure
       This routine makes a matrix of plots with common axes, as opposed to
       the method of !p.multi where axes are separated to allow labels.
       Here the plots are joined and labels are suppressed, except at the
       left edge and the bottom.  You tell multiplot how many plots to make
       using either !p.multi (which is then reset) or the parameter pmulti.
       However, multiplot keeps track of the position by itself because
       !p.multi interacts poorly with !p.position.
Revision History
       write, 21-23 Mar 94, Fred Knight (knight@ll.mit.edu)
       alter plot command that sets !x.window, etc. per suggestion of
         Mark Hadfield (hadfield@storm.greta.cri.nz), 7 Apr 94, FKK
       add a /default keyword restore IDL's default values of system vars,
         7 Apr 94, FKK
       modify two more sys vars !x(y).tickformat to suppress user-formatted
         ticknames, per suggestion of Mark Hadfield (qv), 8 Apr 94, FKK
       Converted to IDL V5.0   W. Landsman   September 1997

Last modified by pro2html on 2001 April 26 at 03:14 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically