views:

45

answers:

2

I want to use a words like, let's say, 'A', 'B' and 'C' on X-axis to show their corresponding properties on Y-axis. How can I write these strings on X-axis instead of numerical data?

+3  A: 

Set yourself up a cell with your letters (mine's called labels), then use the XTick property to set the same amount of ticks on the x axis as your label number. Finally, the XTickLabel property will write your labels to the x axis.

x = yourXdata;
y = yourYdata;
labels = {'A' 'B' 'C'};
plot(x, y);
set(gca, 'XTick', 1:3, 'XTickLabel', labels);
Geodesic
+4  A: 

Here's a simple example:

x = 1:5;
y = rand(size(x));
plot(x, y, 'b')
set(gca, 'XTick',1:5, 'XTickLabel',{'A' 'B' 'C' 'D' 'E'})

alt text

Amro