Keywords: GMT_Docs

Next: 4.14 Specifying area fill Up: 4. General features Previous: 4.12 PostScript Features Contents Index

# 4.13 Specifying pen attributes

A pen in GMT has three attributes: width, color, and texture. Most programs will accept pen attributes in the form of an option argument, with commas separating the given attributes, e.g.,

-W[width[cipm]],[color],[texture[cipm]]

  Width is by default measured in units of the current device resolution (i.e., the value assigned to the parameter DOTS_PR_INCH in your .gmtdefaults4 file). Thus, if the dpi is set to 300 this unit is 1/300th of an inch. Append c, i, p, or m to specify pen width in cm, inch, points (1/72 of an inch), or meters, respectively. Note that a pen thickness of 5 will be of different physical width depending on your dpi setting, whereas a thickness of 5p will always be 5/72 of an inch. Minimum-thickness pens can be achieved by giving zero width, but the result is device-dependent. Finally, a few predefined pen names can be used: default, faint, and {thin, thick, fat}[erest], and obese. Table 4.4 shows this list and the corresponding pen widths.

  Table 4.4: GMT predefined pen widths.
  Pen name | Width | Pen name | Width
  faint | 0 | thicker | 1.5p
  default | 0.25p | thickest | 2p
  thinnest | 0.25p | fat | 3p
  thinner | 0.50p | fatter | 6p
  thin | 0.75p | fattest | 12p
  thick | 1.0p | obese | 18p

  The color can be specified in five different ways:
  1. Gray. Specify a gray shade in the range 0-255 (linearly going from black [0] to white [255]).
  2. RGB. Specify r/g/b, each ranging from 0-255. Here 0/0/0 is black, 255/255/255 is white, 255/0/0 is red, etc.
  3. HSV. Specify hue-saturation-value, with the former in the 0-360 degree range while the latter two take on the range 0-14.10.
  4. CMYK. Specify cyan/magenta/yellow/black, each ranging from 0-100%.
  5. Name. Specify one of 663 valid color names as defined in the X11 color table4.11. A very small yet versatile subset consists of the 29 choices white, black, and [lightdark]{red, orange, yellow, green, cyan, blue, magenta, graygrey, brown}. The color names are case-insensitive, so mixed upper and lower case can be used (like DarkGreen).

  The texture attribute controls the appearance of the line. A ``.'' yields a dotted line, whereas a dashed pen is requested with ``-''. Also combinations of dots and dashes, like ``.-'' for a dot-dashed line, are allowed. The lengths of dots and dashes are scaled relative to the pen width (dots has a length that equals the pen width while dashes are 8 times as long; gaps between segments are 4 times the pen width). For more detailed attributes including exact dimensions you may specify string:offset, where string is a series of numbers separated by underscores. These numbers represent a pattern by indicating the length of line segments and the gap between segments. The offset phase-shifts the pattern from the beginning the line. For example, if you want a yellow line of width 0.1 cm that alternates between long dashes (4 points), an 8 point gap, then a 5 point dash, then another 8 point gap, with pattern offset by 2 points from the origin, specify -W0.1c,yellow,4_8_5_8:2p. In general, the texture units can be specified in dpi units, cm, inch, points, or meters (see width discussion above).

Table 4.5 contains additional examples of pen specifications suitable for, say, psxy.

Table 4.5: A few examples of pen specifications.
Pen example | Comment
-W0.5p | Solid black line, 0.5 point thick
-Wgreen | Solid green line with default width
-Wthin,red,- | Dashed, thin red line
-Wfat,. | Fat dotted line [black]
-W0.1c,120-1-1 | Green (in h-s-v) pen, 1 mm thick
-Wfaint,100/0/0/0,..- | Very thin, cyan (in c/m/y/k), dot-dot-dashed line

Next: 4.14 Specifying area fill Up: 4. General features Previous: 4.12 PostScript Features Contents Index