필터 지우기
필터 지우기

How to change figure axes aspect ratio

조회 수: 22 (최근 30일)
Brian Dowling
Brian Dowling 2019년 3월 20일
댓글: Brian Dowling 2019년 3월 20일
I have a figure, but the x axis has bunched up, Its range is about 36 units long while, the y and z axes are just four, and Matlab seems to auto bunch the values, It's making my figure look silly. Tried to write a line to change DataAspectRatio but it doesn't work, perhaps my syntax is incorrect. I can change it manually in drop down menus but I need it to do things automatically. Currently DataAspectRatio is stuck at [8.8889,1,1]. I need it at [1,1,1].
Thanks
  댓글 수: 1
dpb
dpb 2019년 3월 20일
Can you attach a short piece of code that produces the errant figure? Hard to know what's going on w/o anything specific to look at...

댓글을 달려면 로그인하십시오.

채택된 답변

Brian Dowling
Brian Dowling 2019년 3월 20일
Apologies!
This is the piece of code that didn't quite work:
set('DataAspectRatio',[1,1,1]);
As you can see the x-axis is somewhat squashed! I need these values to 'spread out' so to speak so the values are equally spaced. I can change it in the following menu, but need to write a line of code, as I need to execute the section multiple times:
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 3월 20일
set(gca,'DataAspectRatio', [1 1 1]);
Brian Dowling
Brian Dowling 2019년 3월 20일
If I was beside you I would shake your hand and buy you a beer. Worked a charm!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by