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')
最后結果