Why does copyobj return an error when Copying Legends or Colorbars in MATLAB R2014b?
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 7 Okt. 2014
Beantwortet: MathWorks Support Team
am 7 Okt. 2014
Why does copyobj return an error when copying legends or colorbars in MATLAB R2014b?
Akzeptierte Antwort
MathWorks Support Team
am 7 Okt. 2014
Starting in MATLAB R2014b, legends and colorbars must be associated with an axes. If you want to copy a legend or a colorbar using copyobj, you also must copy the associated axes.
Copying a legend without the associated axes returns an error message. For example:
plot(rand(2))
l = legend('show'); % legend
ax = gca; % associated axes
fnew = figure; % new figure
copies = copyobj(l,fnew); % copy only legend to new figure
Error using matlab.graphics.illustration.Legend/connectCopyToTree (line 5)
A legend must be copied with its associated axes. Use a vector input with COPYOBJ in order to copy the legend and axes together.
You must copy both the legend and the associated axes.
copies = copyobj([l,ax],fnew)
2x1 graphics array:
Legend (data1, data2)
Axes
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!