Expand subplot to fill entire figure
18 ビュー (過去 30 日間)
古いコメントを表示
I often plot Bode plots to plot the magnitude and phase of a complex function:
ax = subplot(2,1,1)
semilogx(f, db(H)); % plot the magnitude
ax(2) = subplot(2,1,2);
semilogx(f, angle(H)*180/pi); % plot the phase
Often I want to just look at the magnitude while ignoring the phase, but it would be nicer if this didn't mean commenting out the subplot commands.
Is there a simple way to temporarily expand one of these subplots to fill the entire figure, as if it were just a subplot(1,1,1)? Something like:
focus(ax(1)); % just look at ax(1)
restore(ax); % return to the view of two subplots
?
0 件のコメント
回答 (1 件)
Walter Roberson
2011 年 6 月 14 日
oldunits = get(ax(1), 'Units');
oldpos = get(ax(1), 'Position');
set(ax(1), 'Units', 'normal', 'Position', [0 0 1 1]);
Then later
set(ax(1), 'Units', oldunits, 'Position', oldpos);
If you were enthusiastic enough, you could store the old units and position via setappdata()
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!