フィルターのクリア

How to make axes have proportional scales?

1,124 ビュー (過去 30 日間)
HamA
HamA 2017 年 11 月 4 日
コメント済み: Walter Roberson 2021 年 12 月 21 日
Hi, I would like the x and y axes on my surf plot to have proportional scales. I am plotting temperature over a 2D plane. I want to visualise the temperature profile but the x and y axes stretch to fit the figure window, stretching the temperature profile.
I want the axes to have the same 'unit:distance on screen' ratio. How can I do this? I have been finding the aspect ratio help not very helpful Thanks

採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 4 日
If you want them to have equal scales then
axis equal
Otherwise set the axes DataAspectRatio property. For example,
set(gca,'DataAspectRatio',[10 1 1])
would mean that every 10 units of x is to have the same size as one unit of y -- which would make something of x width 10 and y height 1 into a square.
  3 件のコメント
Joshua
Joshua 2021 年 12 月 21 日
Hi Walter,
I am plotting some coordinate data and which lies primarily along one axis (y axis). For my plots I wish to have equal axis scales but with a different aspect ratio to reduce white space by adjusting the width of the other axis (x axis). Any idea how to achieve this? The issue is illustrated in the following figures.
Current plot:
Desired (edited in powerpoint):
Of course one could do this manually by changing the aspect ratio of the figure but do you have any Ideas on an easier way?
Regards
Walter Roberson
Walter Roberson 2021 年 12 月 21 日
xlim?

サインインしてコメントする。

その他の回答 (2 件)

karipuff
karipuff 2019 年 11 月 13 日
daspect([1 1 1])
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 11 月 13 日
Yes, this is another way to set the axes dataaspect property

サインインしてコメントする。


Ermanno Manca
Ermanno Manca 2020 年 6 月 23 日
Hi, i'm using Matlab App Designer.
Unfortunately i have the same problem. But by typing "set(gca,'DataAspectRatio',[10 1 1])" it opens a figure instead of changing the axis scale in my app.UIAxis plot.
How can i have the same scale for x and y axis in my app.UIAxis plot?
Thanks a lot
  3 件のコメント
Ermanno Manca
Ermanno Manca 2020 年 6 月 24 日
Hey thanks, axis(app.MyAxes1, 'equal') didn't work for me.
I didn't try app.MyAxes1.DataAspectRatio = [1 1 1] but i guess it'll work too.
I found set(app.MyAxes1,'DataAspectRatio',[1 1 1]) so that worked out too.
Thanks for your help and your wuick response!
Jonahtan González
Jonahtan González 2021 年 1 月 19 日
@Walter Roberson thank you very much.
app.MyAxes1.DataAspectRatio = [1 1 1]
Worked for me.

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by