Ho to combine two legend in the same axe ( GUI MATLAB)
Show older comments
Hello,
In my interface, I call two plot,in the same plot function. This is the reference1 and renference2.
function is updated at each call. I dont want that the legend is also updated
What is the solution to manage legend.
if ishandle(tracesnew.handleTrace1) %
set(tracesnew.handleTrace1, 'XData', x, 'YData', y)
else
traces.handleTrace1 = plot(x,y,coul)
end
legend( traces.handleTrace1,'refereence1','reference2') ;
For the second call, I'd like renference2 is also displayed.
2 Comments
Geoff Hayes
on 21 Jul 2014
From the above code, it appears that on the second time that a function is called, the data that has been originally plotted is replaced with the new x and y data. It is unclear why you would wish to display two messages in your legend since only one plot remains. Or is something else plotted on the same axes?
Does reference 1 correspond to the first plot ( traces.handleTrace1 = plot(x,y,could) ), and reference 2 the second ( set(tracesnew.handleTrace1, 'XData', x, 'YData', y) )?
bekoto raz
on 21 Jul 2014
Accepted Answer
More Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!