yorick banner




Global Index


Quick Reference

Back: plv Forward: Plot limits   FastBack: Graphics Up: Plotting primitives FastForward: Plot limits         Top: Yorick Contents: Table of Contents Index: Concept Index About: About this document

3.1.9 plt

The final plotting command, plt, plots text rather than geometrical figures:

plt, text, x, y

Optional keywords determine the font, size, color, and orientation of the characters, and the precise meaning of the coordinates x and y -- what coordinate system they are given in, and how the text is justified relative to the given point.

Unlike the other plotting primitives, by default the (x,y) coordinates in the plt command do not refer to the same (x,y) scales as your data. Instead, they are so-called normalized device coordinates, which are keyed to the sheet of paper, should you print a hardcopy of your picture. To make (x,y) refer to the so-called world coordinates of your data (what planet is your data from?), you must use the tosys=1 keyword. If you do locate text in your world coordinate system, only its position will follow your data as you zoom and pan through it; don't expect text size to grow as you zoom in, or your characters to become hideously distorted when you switch to log axis scaling.

Text may be rotated by multiples of 90 degrees by means of the orient= keyword. Arbitrary rotation angles are not supported, and the speed that rotated text is rendered on your screen may be dramatically slower than ordinary unrotated text.

You can get superscripts, subscripts, and symbol characters by means of escape sequences in the text. Yorick is not a typesetting program, and these features will not be the highest possible quality. Neither will what you see on the screen be absolutely identical to your printed hardcopy (that is never true, actually, but superscripts and subscripts are noticeably different). With those caveats, the escape feature is still quite useful.

To get a symbol character (assuming you are a font other than symbol), precede that character by an exclamation point -- for example, "!p" will be plotted as the Greek letter pi. There are four exceptions: "!!", "!^", and "!_" escape to the non-symbol characters exclamation point, caret, and underscore, respectively. And "!]" escapes to caret in the symbol font, which is the symbol for perpendicular. The exclamation point, underscore, and right bracket characters are themselves in the symbol font, and shouldn't be necessary as escaped symbols. If the last character in the text is an exclamation point, it has no special meaning; you do not need to escape a trailing exclamation point.

Caret "^" introduces superscripts and underscore "_" introduces subscripts. There are no multiple levels of superscripting; every character in the text string is either ordinary, a superscript, or a subscript. A caret switches from ordinary or subscript characters to superscript, or from superscript to ordinary. An underscore switches from ordinary or superscript characters to subscript, or from subscript back to ordinary.

If the text has multiple lines (separated by newline "\n" characters), plt will plot it in multiple lines, with each line justified according to the justify= keyword, and with the vertical justification applied to the whole block. You should always use the appropriate text justification, since the size of the text varies from one output device to another -- the size of the text you see on your screen is only approximately the size in hardcopy. In multiline text, the superscript and subscript state is reset to ordinary at the beginning of each line.

Here is an example of escape sequences:

text = "The area of a circle is !pr^2\n"+
  "Einstein's field equations are G_!s!n_=8!pT_!s!n";
plt, text, .4,.7,justify="CH";

Back: plv Forward: Plot limits   FastBack: Graphics Up: Plotting primitives FastForward: Plot limits         Top: Yorick Contents: Table of Contents Index: Concept Index About: About this document