在matlab中如何摆脱回归图中的蓝线?

时间:2016-04-15 16:03:34

标签: matlab plot regression

我有一个蓝色(lsline)的回归图,我想消除它,但我不知道如何。

plotregression(y.testTargets, y.outputs)

1 个答案:

答案 0 :(得分:1)

如果您只想删除蓝线,可以使用findall检索线对象的句柄,然后delete。同样基于@ rayreng的反馈,我做了这个,以便自动从图例中删除该行。

r = plotregression(rand(5,1), rand(5,1));

%// Make the legend dynamic before removing the line
legend('-DynamicLegend', 'Location', get(legend, 'Location'));

%// Remove the blue line (with the "Fit" label)
delete(findall(r, 'DisplayName', 'Fit'));

enter image description here