Labels and figure properties







Title

plt(...,'Title',s);
Inserts the title string t above the plot area.
s is usually a string, although it may also be a cell array of strings to specify a multi-line title.

The Tex interpreter is used to render the string allowing entry of Greek and other special characters. If you don't want the Tex interpreter to be used, you can turn off the interpreter with a command such as:

set(get(gca,'title'),'interpreter','none');

A shorter (although more cryptic) way of turning off the interpret is to include the string [TexOff] anywhere in the first line of the title. (The [TexOff] string will be deleted from the title before display). That method works only for graph titles.

A set command similar to the one above may be used to change the fontsize or other title properties. The plot height is automatically shrunk by the amount needed to make room for the title assuming the default font size. If you increase the title font size you may need to adjust the plot size using the xy parameter described in the Axis properties section.

If s is a number is will be converted to a string. For example:

plt(...,'Title',{123 7.88})

will create a two line title with '123' as the first line and '7.88' as the second line.

Default: no title

LabelX

plt(...,'LabelX',s);
Uses string s as the x-axis label. If you are using subplots with two columns, you may also specify the x-axis label for both the left and right columns of plots by using a cell array:

plt(...,'LabelX',{'left Xlabel' 'right Xlabel'});

If there is only one column of subplots (or no subplots at all), the a cell array argument represents a multi-line axis label, as in:

plt(...,'LabelX',{'First line' 'Second line'});

Even when you have multiple X labels, you can still use multi-line labels, as in:

plt(...,'LabelX',{'X left' {'Xright line1' 'Xright line2'});

The Tex interpreter will be used by default for X and Y axis labels. If for some reason you want to disable the Tex interpreter, you can do so with a command such as:

set(get(gca,'Xlabel'),'interpreter','none');

Default: 'x axis'

LabelY

plt(...,'LabelY',s);
Uses string s as the left hand y-axis label of the main plot. You can specify both the left and right labels by using a cell array. For example, if there are no subplots, both these lines are equivalent:

'LabelY',{'ab' 'cd'}
'LabelY','ab','LabelYR','cd'

If there are subplots, the right hand axis label must come last. For example with 3 subplots:

plt(...,'SubPlot',[50 20 30],'LabelY',...
   {'lower-axis' 'middle-axis' 'upper-axis' 'right-hand-axis'});


In a similar way as described for titles, if you specify a number for the X or Y axis label it will be automatically converted to a string. You may also use multi-line text for the Yaxis labels in a similar way as described above for the Xaxis labels. The demo program gpsLog.m is a good example of how to use multi-line text for both X and Y axis labels.

Default: 'Y axis (Left)'

LabelYR

plt(...,'LabelYR',s);
Uses string s as the right hand y-axis label. The 'right' parameter should also be included in this case, however if you don't, plt will default to placing the last trace on the right hand axis. Note that using a cell array argument to the 'LabelY' parameter (described above) is usually a more convenient way to specify the y-axis label, and the 'LabelYR' parameter is primarily used in legacy code.

Default: 'Y axis (Right)'

FigName  

plt(...,'FigName',f);
Uses string f as the name for the plt figure window.

Default: 'plt'

Position
Pos

plt(...,'Position',[xLeft yBottom height width]);
plt(...,'Position',[height width]);
Specifies the figure size and position on the screen in pixels.

Since 9 and 55 are the default values for xLeft & yBottom respectively, the second form above (with xLeft and yBottom omitted) is equivalent to: plt(...,'Position',[9 55 height width])

If you prefer conciseness, you may use 'Pos' as an abbreviation for 'Position'.

If the height is specified as zero, plt will choose a height so that a unit along the x-axis is the same as a unit along the y-axis (i.e.if you plot a circle, it would look like a circle and not an ellipse). If the width is specified as zero, plt chooses the width to meet the same condition. (You can't specify zero for both the height and the width). If you resize the figure window with the mouse, then the units along the x and y axes will no longer be equal (and a plotted circle may appear to be an ellipse). If you wish that the equal units property to be maintained even after the figure window is resized, you should follow the plt command with the command axis('equal').

If you specify the same position vector for more than one plt command, plt will add a small offset to all the figure window positions (except the first one) so that no two figures are exactly on top of each other. This feature makes it less likely that you will completely loose sight of one of the figures and also makes it much easier to select or move any figure with the mouse. If a second plt command specifies a position that differs from the first plt command by even one pixel, then this feature will not be engaged.

Default: [9 55 700 525] (if sublots are not used). With subplots, as you add more columns of axes the default width increases from 700 to a maximum of 980. As you add more axes to a column the default height increases slightly from 525 to a maximum of 600.

HelpText

plt(...,'HelpText',v);
This parameter creates a HelpText pseudo object at the same time as the plt pseudo is being created. v is a string or cell array specifying the displayed text. When this argument is included in the plt argument list, right clicking on the menu box Help tag will toggle the help text on or off (unless the 'HelpFileR' argument is also included in the argument list). See the Pseudo objects section for a description of the format of the v argument. Also look at the following demo programs which use the HelpText parameter: editz, gauss, gpsLog, pltquiv, subplt, tasplt, and wfalltst. The curves, julia, and trigplt, demo programs also uses HelpText, although the helptext is specified in a separate plt call instead of when the plot was created in the initial call to pltinit.

Link

This parameter is used to force a group of plt figures to close when any member of the group is closed. Consider the following sequence:

plt(x1,y1);
g = gcf;
plt(x2,y2,'Link',g);
plt(x3,y3,'Link',g);

This of course will create 3 plotting figures. Closing any one of the three figures will also cause the other two to close.

The link parameter is ignored if it is empty. This makes it easier to link figures created in a loop. For example, this loop creates five linked figures:

g = '';
for k=1:5
  plt(x{k},y{k},'Link',g);
  if isempty(g) g=gcf; end;
end;

The demo programs circles12, gpsLog, pub, pub2, and tasplt take advantage of this parameter.

CloseReq

This parameter specifies a function that will be run when the plt window is closed. The argument may be:
  • a string (as shown in the plt50.m example).
  • a function handle (as shown in the afilt.m example).
  • a cell array containing a function handle and its arguments (as shown in the wfall.m example).
Note that if the function is defined as a string argument often consecutive single quote characters are required (quotes within quotes). In that case readability can be improved by replacing all sequences of two consecutive single quotes with a double quote character. For example 'disp(''ABC'');' could be written as 'disp("ABC");'. Note that this trick does not work for Matlab callbacks in general, but it does work for any callback defined within a plt(...) function call.

Fig

Normally plt opens a new figure window when it is called. In some situations you may want to tell plt to use a pre-existing figure instead. (The most common reason this is done is to put more than one plot into a single figure.) This parameter tells plt to do this and specifies which figure window should be used. For example, to open plt using figure number 4, you would use plt('Fig',4,...);. More often you will probably use plt('Fig',gcf,...); which will open plt in the current figure. Generally the plt parameters may be placed anywhere in the parameter list, and in fact the Fig parameter is the only exception to this. The Fig parameter must be placed either as the first or the last parameter in the argument list. The Fig parameter is ignored otherwise. This restriction is due to lazy programming more than any other reason, and the restriction might be removed in a later release.

There are three example programs (afilt.m, plt50.m and pub3.m) which are described in the Programming examples section that demonstrate the use of the Fig parameter to put multiple plots in a single figure. The first two (afilt & plt50) are oriented towards data exploration and takes advantage of the full generality of plt's cursoring system for both plots. The third one (pub3) is oriented towards creating a figure for publication and so all the cursors have been disabled to create a clutter free result.

There is also another method to create multiple plots in a single figure, and this makes use of the subplot parameter. (This is demonstrated by the subplt.m, subplt8.m, subplt16.m, subplt20.m, pub0.m, pub2.m, pltmap.m, and weight.m programming examples). You might not expect that there would be a need for two different methods for achieving the same end, but it turns out that each of these methods have their unique advantages. The subplot method (described in the Axis properties section) is sometimes simpler because all the plots are created with a single call to plt. The subplot method imposes significant restrictions on the plots, but in turn this allows the cursor controls to be more compact which makes cursoring possible on a figure with many more plots than would be possible with the Fig method. The subplot method also provides an option for linking the cursors of the plots in a single column. Most of the programming examples with multiple plots per figure would have been difficult to impossible without the correct choice between the subplot and Fig parameter methods.