Text strings can be put on a plot to labels axes, give a title, as a legend for each trace, and to put text at user-specified coordinates. There is some control over the character size and font used, and there is a primitive syntax for non-standard characters that allows Greek letters, the Ångstrom symbol, subscripts, and superscripts. Like many aspects of PGPLOT, the possibilities are limited, but include a reasonable set of functionality needed for most applications. The full list of plot() keywords affecting the placement of text strings on the plot window are given in Table 7. In addition to the plot() command, the plot_text() command can be used to put text strings at selected x-y coordinates.
|xlabel||the label of the x-axis|
|ylabel||the label of the y-axis|
|title||plot title along top|
|key||keyword describing each trace for legend|
|charfont||integer to select font for text|
|charsize||character size for all characters and markers|
|labelsize||character size of axis labels and numbers|
|textsize||character size of text strings and legend keys|
|markersize||size of plotting point markers|
|text||text string for a general plot label|
|text_x||x-coordinate for this text string|
|text_y||y-coordinate for this text string|
The keywords xlabel and ylabel set the labels for the x-axis and y-axis, respectively, while title will set the title above the drawing box. Each x-y trace can have a legend that will appear along the right side of the plot, with a short version of the plot line style and a ``legend key'' - a short text string that you can set with the key keyword, as in
Ifeffit> plot(dat.r,dat.chir_mag, color=red, key='data') Ifeffit> plot(fit.r,fit.chir_mag, color=red, key='fit')
Text strings can also be put anywhere on the plot using either the text keyword, which will put a label at a coordinates specified by the keywords text_x and text_y or by the plot_text() command.7
You can put on multiple labels (up to 32) on a plot, but once on they can only be erased by making a new plot, which will erase all the labels.
Ifeffit> plot( text='300 K Data', text_x=7025, text_y=0.2)or
Ifeffit> plot_text(x=7025,y=0.3, text='400 K Data') Ifeffit> plot_text( 7025, 0.5, '500 K Data')As you can see, the advantage of the plot_text() variation is that it has default positional keywords for x, y, and text which greatly simplifies the syntax. Such labels are often useful when coupled with arrows, discussed in section 5.5.
The sizes of the various text strings and plot markers can each be set separately. The text size for the axis, x- and y-labels, and title can be set with the keyword labelsize. The text size for legend keys and explicitly-placed text strings are set with the keyword textsize. The size of the point markers for point and linespoints line styles are set with the markersize keyword. The keyword charsize will set all of the sizes to the same value. The value taken is a real number, with appropriate values usually in the range of 1.0 to 3.0. To completely suppress the axis text, you might be tempted to set labelsize to zero. This can cause odd results, so using a very small value such as
Ifeffit> plot(dat.x, dat.y, labelsize=0.0001)will effectively suppress the axes from being drawn.
The syntax of the text strings themselves is almost straightforward. The PGPLOT documentation gives a more complete description, but I'll outline the main points here. Most text is displayed as typed, of course. You can also use ``control sequences'' to control formatting and special characters.
PGPLOT uses Hershey (vector) fonts which are easy to render when rotated but look slightly less than ideal. You can specify one of four fonts as the default font with the charfont keyword, which takes an integer 1-4 as its value. Charfont =1 is the normal typeface - a sans serif font. Charfont = 2 gives a roman font, Charfont = 3 gives an italic font, and Charfont = 4 gives a script font which is pretty difficult to read. You can mix these fonts in a text string with the an escape sequence.
To get Greek characters, escape sequences starting with \g are used: \gm give , for example. Subscripts are done with \d and superscripts with \u. There are no sub-subscripts, super-superscripts, sub-superscripts, etc. The Ångstrom symbol is \A. Examples of these, and some string sequences to get common symbols for XAFS analysis are shown in Figure 3, and are provided in the examples distributed with IFEFFIT.