HELP ON PLOT LEGEND, ERROR APPEARED for the third run!!
1 次查看(过去 30 天)
显示 更早的评论
Hi guys, I'm having trouble trying to add multiple entries on my legend, it was working perfectly fine during the first and second run (I'm so regretful for not saving it :(. However, on the third run, error turned up as shown below, I've attached Figure which was created when there's no legend, and the Figure 2 is when I've added multiple entries on the legend as well as fixing the position of my legend (I'm wondering if it's something to do with the matlab legend tool??):
legend('measurement','HYCOM','run07','Location','northwest') %This is the legend line added to my code for the 1st plot in Figure 1 legend('measurement','HYCOM','run07','Location','southwest'); %This is the legend line added to my code for the 2nd plot in Figure 1
Figure 1 (Without Legend)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151464/image.png)
Figure 2 (With Legend)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151466/image.png)
Property name already in use by this class or one of its superclasses.
Error in scribe.legend/init (line 71) l = schema.prop(handle(fig),'ScribeLegendListeners','MATLAB array');
Error in scribe.legend (line 122) h.init();
Error in legend>make_legend (line 387) lh=scribe.legend(ha,orient,location,position,children,listen,strings,propargs{:});
Error in legend (line 285) [h,msg] = make_legend(ha,varargin(arg:end));
Error in SamMainPlotCTD (line 42) legend('measurement','HYCOM','run07');||||
0 个评论
采纳的回答
Thorsten
2015-11-6
Use handles:
h(1) = subplot(1,2,1), plot(rand(10,3))
h(2)= subplot(1,2,2), plot(rand(10,3))
legend(h(1), {'measurement','HYCOM','run07'},'Location','northwest')
legend(h(2), {'measurement','HYCOM','run07'},'Location','southwest')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!