gline

Interactively add line to plot

Syntax

gline(h)
gline
hline = gline(...)

Description

gline(h) allows you to draw a line segment in the figure with handle h by clicking the pointer at the two endpoints. A rubber-band line tracks the pointer movement.

gline with no input arguments defaults to h = gcf and draws in the current figure.

hline = gline(...) returns the handle hline to the line.

Examples

Use gline to connect two points in a plot:

x = 1:10;

y = x + randn(1,10);
scatter(x,y,25,'b','*')

lsline

mu = mean(y);
hold on
plot([1 10],[mu mu],'ro')

hline = gline; % Connect circles
set(hline,'Color','r')

See Also

| |

Was this topic helpful?