Problems with legend in R2016b
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Why can I no longer add a plot with a legend in R2016b same way it used to be in previews versions?
During the migration to R2016b or R2017a, the script show some problems with legend function in the plot.
An example is a simple line after a plot: legend('Curve1','Curve2',1);
While it used to work fine prior to R2016b, we see the following response :
Error using legend>process_inputs (line 582) Invalid argument. Type 'help legend' for more information.
Error in legend>make_legend (line 340) [autoupdate,orient,location,position,children,listen,strings,propargs] = process_inputs(ha,argin); %#ok
Error in legend (line 294) make_legend(ha,args(arg:end),version);
Error in Script_plot (line 274) legend('Curve1','Curve2',1);
0 Kommentare
Antworten (3)
Star Strider
am 27 Mär. 2017
The numeric location designations have been deprecated. Use the 'Location' name-value pair instead:
legend('Curve1','Curve2', 'Location','NE')
2 Kommentare
Shlomit Beker
am 5 Okt. 2018
This solution doesn't work for me (2017a). Any other solution for this problem?
Walter Roberson
am 5 Okt. 2018
plot(1:10,rand(1,10),1:10,rand(1,10)); legend('Curve1','Curve2', 'Location','NE')
Looks fine to me in R2017a.
Sebastien AMIOT
am 6 Jun. 2017
2 Kommentare
Star Strider
am 6 Jun. 2017
You have to go back and manually change all the legend calls in your old code.
Walter Roberson
am 7 Jun. 2017
Write your own legend.m function that you put higher in the priority and which detects the use of the old style calls and converts the arguments and calls the built-in legend
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!