Clear Filters
Clear Filters

Axis Values in a Figure

6 views (last 30 days)
Dan
Dan on 13 Feb 2013
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?

Answers (1)

Eric Truslow
Eric Truslow on 13 Feb 2013
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.

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!