Why is legend automatically updated after copying and pasting a plot object in R2017a Prerelease?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 15 Feb 2017
Answered: MathWorks Support Team
on 16 Feb 2017
When manually pasting curves from one plot to another, the legend is always automatically updated in R2017a. I prefer it the way it was in R2016b.
Is there a way to revert back to the original settings?
Accepted Answer
MathWorks Support Team
on 16 Feb 2017
There is a workaround to revert back to the original settings in R2016b. Please take a look at the following code:
%%Defualt legend behavior
f1 = figure;
ax = axes;
p = plot(1:10,25:34);
legend show
f2 = figure;
p2 = plot(1:10);
legend show
copyobj(p2,ax);
%%Setting the legend update property to be 'Off'
f1 = figure;
set(f1,'defaultLegendAutoUpdate','off')
ax = axes;
p = plot(1:10,25:34);
legend show
f2 = figure;
set(f2,'defaultLegendAutoUpdate','off')
p2 = plot(1:10);
legend show
copyobj(p2,ax);
This code contains 2 sections. The first section shows the default behavior for R2017a with "legends", but the second section shows a method in which you can set the ''defaultLegendAutoUpdate'' to be 'Off'.
If you are more comfortable with that solution, you can set this property to be "Off" by default on your installation, by typing the following command:
>> set(groot,'defaultLegendAutoUdpate','off')
0 Comments
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!