How to equalize width & aspect between axes?
9 ビュー (過去 30 日間)
古いコメントを表示
I have two plots stacked vertically. In one, the x and y data have the same units, so I'm using "axes equal." In the second, x & y do not have the same units, but the x data from both plots are the same. Is there some way to equalize the size and aspect of the x axes across the two plots? I assumed that I could just set the x values in the 'Position' property to be equal, but apparently this is not how "axes equal" functions.
I found that the following procedure seems to work:
~make plot 1~
%Make plot 1
set(gca,'DataAspectRatio',[1 1 1])
ar = get(gca,'PlotBoxAspectRatio')
%Make plot 2
set(gca,'PlotBoxAspectRatio',ar)
Does anyone know a more proper way to do this?
0 件のコメント
回答 (1 件)
Image Analyst
2016 年 11 月 6 日
You can set the size of each axes. You did not do that. Moreover, you didn't even change the current axes between your calls to set() so the two sets's will apply to the same axes. Try this:
handles.axes1.Position = [x1,y1,width1, height1];
handles.axes2.Position = [x2,y2,width2, height2];
You can figure out the 2 parameters based on the 1 parameters if you want. You might also be interested in the "axis equal" and/or "axis square" commands.
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!