plot legend disappears after resize
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
the legend of my bodeplot disappears after i resize the figure with my mouse
b = [0 2 3; 1 2 1];
a = [1 0.4 1];
[A,B,C,D] = tf2ss(b,a);
statespace = ss(A,B,C,D) ;
f = figure;
p = bodeplot(statespace(1,1));
setoptions(p,'FreqUnits','Hz','PhaseVisible','off');
legend('test','Location','southwest');
set(f, 'ResizeFcn', @(varargin) legend('test','Location','southwest'))
solves the problem but maybe there is a better solution.
0 Kommentare
Antworten (1)
Sam McDonald
am 16 Nov. 2016
A "bodeplot" creates more than one axes and when calling "legend" without specifying the parent axes, MATLAB takes the last active axes which might be an invisible one leading to undesired behavior. Overall it is the best to specify the axes as input to which the legend refers, e.g.
legend(findall(gcf,'type','axes','visible','on'),'test','Location','southwest');
This will keep the legend visible when resizing the figure.
0 Kommentare
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!