Change saved .fig figure with multiple axes and plots
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!