Previous: pltam Up: ../plot79_p.html Next: pltax3


PLTAX

       SUBROUTINE  PLTAX (X,Y,TITLE,NCHAR,SIZE,THETA,VMIN,DV,VMAX,TICK,
      X     MODE)
 C$    (Draw Labelled and Numbered Linear Axis)
 C$    This routine provides for the drawing of a linear axis with
 C$    optional labelling and  numbering.  To  maintain space  for
 C$    labelling, one will normally call  PLTAX with (X,Y) at  one
 C$    of the corners of an inner frame about one inch inside  the
 C$    page frame.  If  coordinates are in  inches on a  8.5 x  11
 C$    inch  horizontal  page,  SIZE  =  9.0  or  6.5  inches   is
 C$    appropriate.  If PLTGA or PLTGP is used to plot the  graph,
 C$    the plot viewport should be reset to a box of the size  set
 C$    by the axis lengths in  order for the scales to  correspond
 C$    correctly to  the plotted  data points.   All lettering  is
 C$    done with routine SYMTXT which can simulate  a thick pen of
 C$    a diameter settable by a call to SYMPD; this can be used to
 C$    enhance the letter  quality if desired.  It  also  supports
 C$    subscripts,  superscripts,  kerning, and  changes  of font,
 C$    style, and color.
 C$
 C$    The arguments are:
 C$
 C$    (X,Y).....Point  in  world  coordinates  from  which   axis
 C$              originates.
 C$
 C$    TITLE.....Hollerith label  for the  axis.  This  is  always
 C$              drawn centered along  the axis  in the  direction
 C$              away from (X,Y).  Very long titles will be  drawn
 C$              with smaller characters  in order to  fit on  one
 C$              line.    Leading   and   trailing   blanks    are
 C$              automatically  ignored   for  the   purposes   of
 C$              centering.  The special  character sequence  "$N"
 C$              or "$n"  (dollar N)  in the  string represents  a
 C$              newline, and may  be used  to request  multi-line
 C$              text.  For example, the string
 C$
 C$              "title 1$Ntitle 2$ntitle3"
 C$
 C$              will generate three lines of the form
 C$
 C$              title 1
 C$              title 2
 C$              title 3
 C$
 C$              In the  unlikely  event  that  "$N"  is  actually
 C$              needed  in  the  text,  it  can  be  obtained  by
 C$              bracketing  either  character  with  case  switch
 C$              characters.   With  the  default  <PLOT79>   case
 C$              switch characters, this would be $<N> or <$>N.
 C$
 C$    NCHAR..... .GT. 0 - Number  of characters in TITLE(*).  The
 C$                        current font will be used.
 C$               .LE. 0 - No title to be drawn.
 C$
 C$    SIZE......Length of the axis in world units.  SIZE .LE. 0.0
 C$              will be assumed  to be bad  input and will  cause
 C$              immediate return.
 C$
 C$    THETA.....Counterclockwise angle of inclination of axis  in
 C$              degrees.  THETA = 0.0 for a horizontal axis,  and
 C$              90.0 for a vertical axis.
 C$
 C$    VMIN......Starting value of variable along axis.
 C$
 C$    DV........Increment of variable  between successive  ticks.
 C$              numbering will be placed  at each tick, if  there
 C$              is sufficient space.   Otherwise, numbering  will
 C$              be at intervals of 2, 5, or 10 ticks, or at  some
 C$              power of  ten  times one  of  these.  It  is  the
 C$              caller's   responsibility    to    ensure    that
 C$              (VMAX-VMIN)/DV is a positive integer.
 C$
 C$    VMAX......Ending value of variable along axis.
 C$
 C$    TICK...... .GT. 0.0 - Length of tick marks above
 C$                          (counterclockwise from) the axis.
 C$               .EQ. 0.0 - No tick marks to be drawn.
 C$               .LT. 0.0 - Length of tick marks below (clockwise
 C$                          from) the axis.
 C$              A usual value will  be TICK =  0.015 on the  unit
 C$              square, but choosing TICK equal to the length  of
 C$              the perpendicular axes will form a grid.
 C$
 C$    MODE......Option flags stored in the low-order bits of  the
 C$              integer value.  These are selected by adding  one
 C$              or more of the following option values, and  then
 C$              setting the sign of  the resulting sum to  select
 C$              numbering and titling above (+) or below (-)  the
 C$              axis.
 C$
 C$               1 - Number  the  axis.   Even  values  of   MODE
 C$                   suppress numbering,  but  still  affect  the
 C$                   choice of tick mark spacing.
 C$               2 - Numbering   perpendicular (i.e. rotated  -90
 C$                   degrees)  to  the  axis;  otherwise  it   is
 C$                   parallel to the axis.
 C$               4 - Omit the first number along the axis.   This
 C$                   can be useful to  prevent text overlap  when
 C$                   more than one axis is drawn from a point.
 C$               8 - Omit the last number along the axis.
 C$              16 - Omit any zero number  along the axis.   This
 C$                   can be useful for drawing axes  intersecting
 C$                   at the origin.
 C$
 C$              Any value outside the  legal range -31..+31  will
 C$              raise an error condition.  The usual choice for a
 C$              numbered left vertical  (Y) axis will  be MODE  =
 C$              +3, and for a numbered lower horizontal (X)  axis
 C$              will be  MODE  = -1.   The  usual choice  for  an
 C$              unnumbered right vertical axis will be MODE =  +2
 C$              or -2,  and for  an unnumbered  upper  horizontal
 C$              axis will be MODE =  0.
 C$
 C$              The sizes and positions of number labels, even if
 C$              they are not  drawn, affect the  choice of  where
 C$              longer tick marks are drawn.  In the common  case
 C$              where the four  sides of a  graph have axes,  but
 C$              two are  unnumbered,  for  the  unnumbered  axes,
 C$              simply subtract 1  from the  unsigned MODE  value
 C$              used for the opposite numbered axis.
 C$
 C$    Coordinates need  not be  in inches,  for PLTAX  will  work
 C$    correctly in  any  world coordinate  units.   However,  one
 C$    should remember that axes cannot be drawn along the extreme
 C$    edges of  a  viewport, since  all  pen motion  outside  the
 C$    viewport is  suppressed, and  space must  be available  for
 C$    labelling and possibly tick marking.
 C$
 C$    In order  to  avoid  lettering  which  is  horizontally  or
 C$    vertically distorted, one should ensure that a unit  aspect
 C$    ratio  is  in  effect  for  the  world  coordinate  system.
 C$    Although  it  would  be   possible  to  rescale   lettering
 C$    internally in  the case  of a  non-unit aspect  ratio,  the
 C$    problem remains that angles will also be distorted, so that
 C$    axes drawn at other  than multiples of  90 degrees will  be
 C$    skewed.  Internal rescaling of  lettering is therefore  not
 C$    provided.
 C$
 C$    Considerable care has been taken  to make the plotted  axis
 C$    look "nice".  Thus  the title is  centered along the  axis,
 C$    and numbers are centered at their corresponding tick marks.
 C$    numbering is attempted  at the intervals  requested by  the
 C$    caller,  but  if  this  would  cause  overlap  of  adjacent
 C$    numbers, then  the numbering  interval  is increased  by  a
 C$    factor of 2, 5, 10,  or one of these  times a power of  10.
 C$    If this happens, numbered  ticks are drawn somewhat  larger
 C$    than their immediate neighbors.   However, if ticks  larger
 C$    than 10 percent of the  axis length are requested, then  it
 C$    is assumed that they are  intended for drawing grid  lines,
 C$    and then all ticks are drawn the same size.
 C$
 C$    Great effort is expended to determine the optimum format to
 C$    be used  for the  numbers.  Up  to six  figures before  the
 C$    decimal point, and three after  will be used if  necessary.
 C$    if the axis numbers lie  outside this range, then they  are
 C$    rescaled to the range (-10,+10), and a power of ten  factor
 C$    is appended to the last number on the axis.  Floating-point
 C$    forms such  as 1.345e-03  are  not used.   Trailing  zeroes
 C$    which would follow  the decimal  point in  each number  are
 C$    suppressed, and if numbering  is perpendicular to the  axis
 C$    (mode = +2 or -2),  the numbers are right-adjusted (mode  =
 C$    +2) or  left-adjusted  (mode  = -1),  as  is  customary  in
 C$    high-quality hand preparation of drawings.
 C$
 C$    The American Institute  of Physics Style  Manual makes  the
 C$    following recommendations which are worth taking note of:
 C$
 C$    *  For single-column reproduction,  figures will be reduced
 C$       to about 7.5 cm in width.  After reduction, symbols  and
 C$       letters should be  no smaller  than 0.15  cm in  height,
 C$       corresponding to a fractional height of 0.02 on the unit
 C$       square.   Labels  and   numbers  should   be  drawn   in
 C$       characters of the same size,  using a simple font  which
 C$       will tolerate reduction without the loss of serifs.
 C$
 C$    *  Tick marks  should  be placed  at  each number,  and  be
 C$       inside the graph.  They should be about 3/4 the size  of
 C$       the lettering, or about 0.015 on the unit square.
 C$
 C$    *  Dense gridding should be avoided,  and grid lines should
 C$       only be used  if they are  essential for measurement  of
 C$       data from the graph.  Grid lines should extend only from
 C$       numbered ticks.
 C$
 C$    *  Graphs should be enclosed with 4 lines, each with ticks.
 C$       Only the left vertical and bottom horizontal axes should
 C$       be labelled, unless two different vertical or horizontal
 C$       scales are to be illustrated.
 C$
 C$    *  Labelling should be from left-to-right on the horizontal
 C$       axes, and from bottom-to-top on the vertical axes.
 C$
 C$    *  Powers of  ten should  be avoided  in favor  of  Systeme
 C$       Internationale prefixes  where  possible.   Thus,  write
 C$       "nanometers" instead of "meters (x 10**-9)".  If a power
 C$       of ten is required,  it should be  placed with the  last
 C$       number on the axis to avoid ambiguity.  Does "meters  (x
 C$       10)" mean  that  the  numbers  represent  dekameters  or
 C$       centimeters?
 C$
 C$    *  Numbers with  5 or  more digits  on either  side of  the
 C$       decimal point are written with spaces separating  groups
 C$       of three digits to avoid conflict with European reversed
 C$       usage of periods  and commas.  Numbers  with 4 or  fewer
 C$       digits on either side of  the decimal point are  written
 C$       without spaces.   Examples are  "12 000",   "6 427 000",
 C$       "24.077 094 3", "1200", "4620.010", and "24.0032".
 C$
 C$    *  Scales should be chosen  carefully to avoid  excessively
 C$       large blank areas on the graph.
 C$
 C$    (18-Feb-1991)