Figure visibility with corrplot

时间:2016-06-10 16:17:37

标签: matlab matlab-figure

I am trying to save a correlation matrix figure without displaying it. For regular plots I use:

fig1 = figure('visible','off');
plot(x,y);
saveas(fig1,'name','fig');
saveas(fig1,'name','epsc');

This however doesn't work with corrplot. Is there another way?

1 个答案:

答案 0 :(得分:0)

corrplot会创建一个新数字,因此如果您希望在创建数字时关闭可见性,则您需要将DefaultFigureVisible属性设置为'off'然后在创建图形后重新开始。当此设置处于活动状态时,默认情况下将隐藏任何打开的新图形。

set(0, 'DefaultFigureVisible', 'off')
corrplot(data)
set(0, 'DefaultFigureVisible', 'on')

或者,您可以尝试在创建图形后立即切换可见性

corrplot(data)
set(gcf, 'Visible', 'off')

根据corrplot的内部结构,第二个选项可以在实际渲染图形之前切换可见性。