Dave
Dave

Reputation: 2386

Obtain Line Series Handle of Current Figure

Is there any equivalent of gca but instead I want to obtain the handle for a lineseries object (what is returned from plot).

I am using candle which does not return a handle, but would like to modify it's XData aside from copying the code and modifying the function, is there a built in that will allow me to do this?

Upvotes: 1

Views: 605

Answers (2)

venergiac
venergiac

Reputation: 7717

My solution

fighandle = openfig('path of figure.fig','reuse')
ax=findall(fighandle,'Type','line');
x=get(ax,'Xdata')
y=get(ax,'YData')

if there are more than lineseries

xx=x(length(x),1);
xx=xx{1};

Upvotes: 1

Ben Voigt
Ben Voigt

Reputation: 283733

You will probably find that handle (along with many others) in the output of

get(gca, 'Children')

Upvotes: 1

Related Questions