Next: , Previous: key, Up: key


3.24.30.1 key placement

To understand positioning, the best concept is to think of a region, i.e., inside/outside, or one of the margins. Along with the region, keywords `left/center/right` (l/c/r) and `top/center/bottom` (t/c/b) control where within the particular region the key should be placed.

When in `inside` mode, the keywords `left` (l), `right` (r), `top` (t), `bottom` (b), and `center` (c) push the key out toward the plot boundary as illustrated:

          t/l   t/c   t/r
     
          c/l    c    c/r
     
          b/l   b/c   b/r
     

When in `outside` mode, automatic placement is similar to the above illustration, but with respect to the view, rather than the graph boundary. That is, a border is moved inward to make room for the key outside of the plotting area, although this may interfere with other labels and may cause an error on some devices. The particular plot border that is moved depends upon the position described above and the stacking direction. For options centered in one of the dimensions, there is no ambiguity about which border to move. For the corners, when the stack direction is `vertical`, the left or right border is moved inward appropriately. When the stack direction is `horizontal`, the top or bottom border is moved inward appropriately.

The margin syntax allows automatic placement of key regardless of stack direction. When one of the margins lmargin (lm), rmargin (rm), tmargin (tm), and bmargin (bm) is combined with a single, non-conflicting direction keyword, the following illustrated positions may contain the key:

               l/tm  c/tm  r/tm
     
          t/lm                  t/rm
     
          c/lm                  c/rm
     
          b/lm                  b/rm
     
               l/bm  c/bm  r/bm
     

Keywords `above` and `over` are synonymous with tmargin. For version compatibility, `above` or `over` without an additional l/c/r or stack direction keyword uses `center` and `horizontal`. Keywords `below` and `under` are synonymous with bmargin. For compatibility, `below` or `under` without an additional l/c/r or stack direction keyword uses `center` and `horizontal`. A further compatibility issue is that `outside` appearing without an additional t/b/c or stack direction keyword uses `top`, `right` and `vertical` (i.e., the same as t/rm above).

The <position> can be a simple x,y,z as in previous versions, but these can be preceded by one of five keywords (`first`, `second`, `graph`, `screen`, `character`) which selects the coordinate system in which the position of the first sample line is specified. See `coordinates` for more details. The effect of `left`, `right`, `top`, `bottom`, and `center` when <position> is given is to align the key as though it were text positioned using the label command, i.e., `left` means left align with key to the right of <position>, etc.