Reputation: 3011
I have a problem, where I already have a handle to a figure created, and I want to somehow now draw a line, given that handle. For example, I have:
f1 = figure(1);
a1 = gca;
For commands like plot
and surf
, I can pass the axes and/or figure handles to tell it to plot to that particular figure. However, how do you do this with the line
command? There does not seem to be a way as far as I know... thank you.
Upvotes: 1
Views: 135
Reputation: 114866
Have you tried the `Parent' property?
line( x, y, 'Parent', a1 );
see line properties for more info.
Upvotes: 2
Reputation: 18484
The line
function, like patch
is a low level function. The plot command are built on top of these. However you can do this:
f1 = figure(1);
a1 = gca;
line([0 1],[0 1],'Parent',a1); % Parent has to be an axis handle
You can find more line options here: line properties or type doc Line_Props
in the Matlab command window.
Upvotes: 4