xq的问题,想把Matlab的legend点形状不想要多余的线,即将2-4的legendline去除。
解决:
参考http://blog.csdn.net/xiaojidan2011/article/details/10208137,感谢作者。
line_fewer_markers是针对线的legendline off,对于点的legend off,我用的比较土的解决方法。即点位偏移一点点,形成线,再用作者的这个line_fewer_markers.m代码。
xx=-7:-6;
yy=polyval(P,xx);
plot(xx,yy,'-k','Linewidth',2)
hold on
line_fewer_markers([-6.488,-6.489],[-40.829 ,-40.828],9,'color','r','marker','^','MarkerFaceColor','r','spacing','curve','LegendLine','off');
hold on
line_fewer_markers([-6.455,-6.456],[-40.097 ,-40.096],9,'color','b','marker','s','MarkerFaceColor','b','spacing','curve','LegendLine','off');
hold on
line_fewer_markers([-6.376,-6.377],[-39.691 ,-39.690],9,'color','b','marker','o','MarkerFaceColor','b','spacing','curve','LegendLine','off');
legend('降水线','120m处水','24m处水','干扰井水','Location','SouthEast')
最后结果