我创建了几个条形图和分散点脚本来绘制我的数据。问题是Matlab在创建绘图时显示每个绘图,使得事情非常具有破坏性(在绘图完成之前我无法做任何其他事情)。我已经尝试过在Mathworks.com和here on Stack Exchange上发布的几种方法,但它们都没有奏效。这是我的散点图代码示例:
fig = figure(456);
scatter(Data(:,1),Data(:,2),'filled');
hold on;
h = plot(Data(:,1),b,'-');
legend(h,sprintf('r = %s, p = %s',num2str(r),num2str(p)));
title(sprintf(<plot title>));
xlabel(sprintf('%s',set1.textdata{1,z+2}));
ylabel(sprintf('%s',set2.textdata{1,f+2}));
hold off
set(findall(fig,'type','text'),'fontSize',16,'fontweight','bold')
saveas(figure(456),fullfile(output_path, sprintf(<filename>));
close(fig)
有人可以帮忙吗?非常感谢!
答案 0 :(得分:2)
好的,这应该有效:
fig = figure('Visible', 'off');
scatter(Data(:,1),Data(:,2),'filled');
hold on;
h = plot(Data(:,1),b,'-');
legend(h,sprintf('r = %s, p = %s',num2str(r),num2str(p)));
title(sprintf(<plot title>));
xlabel(sprintf('%s',set1.textdata{1,z+2}));
ylabel(sprintf('%s',set2.textdata{1,f+2}));
hold off
set(findall(fig,'type','text'),'fontSize',16,'fontweight','bold')
saveas(fig,fullfile(output_path, sprintf(<filename>));
close(fig)