HELP ON PLOT LEGEND, ERROR APPEARED for the third run!!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Samantha Chong
el 6 de Nov. de 2015
Respondida: Thorsten
el 6 de Nov. de 2015
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 comentarios
Respuesta aceptada
Thorsten
el 6 de Nov. de 2015
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!