Set custom x and y axis
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
Kian Azami
am 7 Okt. 2017
Bearbeitet: Kian Azami
am 7 Okt. 2017
Maybe you just need to use:
xlim([xmin xmax])
ylim([ymin ymax])
2 Kommentare
Kian Azami
am 7 Okt. 2017
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.
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!