필터 지우기
필터 지우기

Set custom x and y axis

조회 수: 18 (최근 30일)
Rahul Thakur
Rahul Thakur 2017년 10월 7일
댓글: Kian Azami 2017년 10월 7일
Hi All,
I have a quick and I believe it would be fairly easy as well but being a newbie I am not able to crack it.
I have one image having x and y axis values as of 0-640 and 0-1024 respectively. Now, I can plot these same numbers easily but is there a way where I can put custom values on both axis as I would like to put 0-1 in y and 0-2 in y axis?
I have tried basic commands such as axis([xmin xmax ymin ymax]) but it also changes the orientation and the image I have completely.
Question: How to plot custom axis value in both axis while keeping the image same?
I have also attached the image I am working on. Please help, thanks.

답변 (1개)

Kian Azami
Kian Azami 2017년 10월 7일
편집: Kian Azami 2017년 10월 7일
Maybe you just need to use:
xlim([xmin xmax])
ylim([ymin ymax])
  댓글 수: 2
Rahul Thakur
Rahul Thakur 2017년 10월 7일
Hi Kian,
Sorry, no it didn't work. As I mentioned in my initial question when I tried this code it changes the orientation of my image and the image as well.
I will probably need something else, I guess.
Kian Azami
Kian Azami 2017년 10월 7일
It is strange that it changes the orientation. Maybe put your image and code here which is easier to check for everyone.
If you want to change the axis values by yourself you need to access to the properties of the axis. So you can do this by going to plot tools and then clicking on the white areas in your figure (I mean to choose the axis) and then go to 'Ticks...' properties and change them.
Or you can do it by writing code:
Figure_Axis = get(gcf,'children');
set(Figure_Axis,'YTickLabelMode','manual')
Y_Label_Positions = get(Figure_Axis,'YTick')
Y_Label = get(Figure_Axis,'YTickLabel')
you need to change Y_Label to show the values that you want. If you want to change their position you need to change the values of Y_Label_Positions also. But before that, you need to make it manual:
set(Figure_Axis,'YTickMode','manual')
You can use the same for the other axis.

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

카테고리

Help CenterFile Exchange에서 2-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