Azzera filtri
Azzera filtri

Axis Values in a Figure

6 visualizzazioni (ultimi 30 giorni)
Dan
Dan il 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?

Risposte (1)

Eric Truslow
Eric Truslow il 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.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by