Effacer les filtres
Effacer les filtres

Axis Values in a Figure

6 vues (au cours des 30 derniers jours)
Dan
Dan le 13 Fév 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?

Réponses (1)

Eric Truslow
Eric Truslow le 13 Fév 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.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by