问题 Since MATLAB R2017a, figure legends update automatically when adding a plot to axes. Previously, one could do this: data = randn(100,4); plot(data) legend('line1','line2','line3','line4') hold on plot([1,100],[0,0],'k-') to plot four data lines with a legend, and then add a black line for y=0. However, since R2017a, this leads to the black line being added to the legend, with the name "data1". How do I prevent this line from being added to the legend, so that the code behaves like it did in