Add case names to plot
h = gname(cases,line_handle)
gname(cases) displays a figure window and waits for
you to press a mouse button or a keyboard key. The input argument
cases is a character array, string array, or cell array of
character vectors, in which each row of the character array or each element of the
string array or cell array contains the case name of a point. Moving the mouse over the
graph displays a pair of cross-hairs. If you position the cross-hairs near a point with
the mouse and click once, the graph displays the label corresponding to that point.
Alternatively, you can click and drag the mouse to create a rectangle around several
points. When you release the mouse button, the graph displays the labels for all points
in the rectangle. Right-click a point to remove its label. When you are done labelling
points, press the Enter or Escape key to stop
gname with no arguments labels each case
with its case number.
cases typically contains unique case names for each point, and is a string
array, cell array of character vectors, or character matrix with each row representing a
cases can also be any grouping variable, which
gname converts to labels.
h = gname(cases,line_handle) returns
a vector of handles to the text objects on the plot. Use the scalar
identify the correct line if there is more than one line object on
You can use
gname to label plots created
This example uses the city ratings data sets to find out which cities are the best and worst for education and the arts.
load cities education = ratings(:,6); arts = ratings(:,7); plot(education,arts,'+') gname(names)
Click the point at the top of the graph to display its label, “New York.”
Introduced before R2006a