필터 지우기
필터 지우기

Axis Values in a Figure

조회 수: 6 (최근 30일)
Dan
Dan 2013년 2월 13일
I draw a figure using:
colormap(hot(num_colors));
image(myMatrix);
The values in the x and y axis are automatically shown in the figure. I want my values to be shown in the x,y axis.
I have two sets of custom strings xvals and yvals, how do I simply append these values to the corresponding axis in the figure?

답변 (1개)

Eric Truslow
Eric Truslow 2013년 2월 13일
To change the tick mark labels you can do something like:
set(gca,'YTickLabel',yvals);
set(gca,'XTickLabel',xvals);
where yvals and xvals are cell arrays of strings. To then change the positions of the tick marks you can use:
set(gca,'YTick',yval_num);
set(gca,'XTick',xval_num);
where xval_num and yval_num are arrays of numbers specifying the values at which to put the tick marks.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by