Change linespec of a line using only the figure handle.
3 次查看(过去 30 天)
显示 更早的评论
Dear all,
I was wondering how I can change the linespec of a set of lines when I already plotted the lines and only have the figure handle. The figure handle is obtained using h=hgload('bla.fig');
Kind regards,
Carlas
0 个评论
回答(3 个)
Sean de Wolski
2012-5-29
hAxChild = get(get(gcf,'children'),'children'); %children of the figure's axes
Then figure out which ones are lines etc..
0 个评论
Wayne King
2012-5-29
Can't you just edit plot from the figure window, then click on the line?
Or click on the object and do:
hco = gco;
set(hco,'linestyle','-.');
for example.
Walter Roberson
2012-5-29
objs = findobj(h, 'Type', 'line');
However, there might be lots of lines and you probably only want to change the width or color or style of some of them. If you were to examine a line object or lineseries object in isolation, would you be able to tell whether it is the one you want to change?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!