The plot, cursor, and grid pseudo objects





plt

(pseudo
plot
object)
The plt pseudo object can be thought of as a super axis and in that respect it's similar to Matlab's plot and plotyy function. You create a plt pseudo object by calling either the plt function or the pltinit function. The plt object is actually created by the pltinit function, but the reason you may also use plt for this is that plt can recognize when you are trying to create a plt pseudo object and when it does, it simply passes all of its arguments to pltinit. Calling pltinit directly of course is more efficent, but the difference is neglible, so it doesn't really matter. Usually we create the plt pseudo object using the plt function when we are doing so from the Matlab command line, simply because it is shorter to type. When doing so from within a .m file, usually pltinit is called because it makes it more clear that we are creating a plt pseudo object, but you could also justify using plt for concisenss.

When a plt pseudo object is created, a new figure window is immediately created to contain the new pseudo object and also two other pseudo objects are automatically created as well (namely cursor and grid described below).

The calling sequence used to create a plt pseudo object is described here.

There are many parameters that control various aspects of the plt pseudo objects, and they are described in these five sections:

cursor

(pseudo
cursor
object)
The cursor pseudo object, more than any of the others is what gives the plt toolbox such an advantage for GUIs involving plotting and data exploration. Once you get used to the smooth and natural methods provided for cursoring, zooming, and panning you will wonder how you lived without them and you will want all your GUI tools to be similarly equipped.

You can learn how to create a cursor pseudo object and how to control its behavior in the Cursor commands section.

grid

(pseudo
grid line
object)
The grid line pseudo object provides the ability to create grid lines for your plots using whatever color and style you choose. Recent Matlab versions provide this capability natively, but the advantage of the grid line pseudo obect is that it works with all Matlab versions which is not true of the native Matlab grid commands.

Grid lines are positioned at each tick label. Additional (sub-decade) grid lines will also be used for logarithmically scaled axes that span six or fewer decades. (The six decade limit may be changed by adjusting the logTR figure application data property which defaults to 1.0e6)

A grid pseudo object is created and controlled using these calling sequences:

plt('grid',ax,'init',color,erMode,LineStyle,In7,In8,In9,In10)
  - Initializes grid lines on axis ax of color color with erase mode erMode and LineStyle LineStyle.
  - color is optional with default [.13 .13 .13]
  - erMode is optional with default 'xor'.
  - LineStyle is optional with default '-'
  - In7,In8 is an optional parameter/value pair to apply to the grid lines
  - In9,In10 is an optional parameter/value pair to apply to the grid lines
            The vbar.m program (in the demo folder) uses this call to create a tabular list next
            to the main plot area. Although that demo as well as the three line example below call
            this 'init' action, you will rarely if ever do this because the grid pseudo object
            is created automatically when you create a plt pseudo object.


plt('grid',ax,'toggle')  - toggle grids (on/off)

plt('grid',ax,'get')     - get grid line handle

plt('grid',ax,'off')     - turn grids off

plt('grid',ax,'on')      - turn grids on

plt('grid',ax,'update')  - update grids

plt('grid',ax)           - same as above

plt('grid')              - equivalent to plt('grid',gca)

All the above calls return the grid line handle. Setting ax to zero in any of these commands is equivalent to specifying gca.
To experiment with these functions, try typing this at the command prompt:

>> plt('grid',axes,'init',[.7 1 1]); % create axis & grid pseudo object
>> set(gca,'ylim',[0 6]);            % change axis limits
>> plt('grid');                      % update grid lines