Change saved .fig figure with multiple axes and plots

조회 수: 1 (최근 30일)
Bob Johnson
Bob Johnson 2011년 9월 2일
Hi, I want to change some properties of a .fig figure that I have saved.
With one set of axes on the figure and one line on the plot, I use the following script to change the LineStyle property:
h_fig = open([folderpath 'figurename.fig']);
h_axes = gca;
h_plot = get(h_axes,'Children');
set(h_plot,'LineStyle','-','LineWidth',3.0,'Color','black')
But, my question is how to do the same change on one set of axes if there are 4 sets of axes on one figure and 2 lines on that plot.
d = 0.06; % distance from edge
fh = figure(305);
ax1 = axes('position',[d 0.56 0.38 0.38])
h1 = plot(x,y)
h2 = plot(x,z)
ax2 = axes('position',[0.56 0.56 0.38 0.38])
h1 = plot(x,y)
h2 = plot(x,z)
ax5 = axes('position',[0.06 0.06 0.38 0.38])
h1 = plot(x,y)
h2 = plot(x,z)
ax4 = axes('position',[0.56 0.06 0.38 0.38])
h1 = plot(x,y)
h2 = plot(x,z)
So, I save this and I want to open it again and change only plot ax1 and change the line type for h2 to
set(h_plot,'LineStyle','-','LineWidth',3.0,'Color','black')
Thanks a lot for your help.
All the best, Bob

답변 (1개)

Grzegorz Knor
Grzegorz Knor 2011년 9월 2일
Try in this way:
lns = findobj('Type','Line');
for k=1:length(lns)
if 'condition for identifying'
set(h(k),'LineStyle','-','LineWidth',3.0,'Color','black')
end
end
Grzegorz

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by