Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
XTickLabel

Subject: XTickLabel

From: Ben

Date: 24 Sep, 2010 11:08:30

Message: 1 of 3

Hello,

I would like to make a graph with XTickLabels.

For example I have 4 data points
y = [1:4];

On the x-axis I want
'a', 'b', 'c', 'd' instead of 1,2,3,4

the problem:
it returns 'a', 'b', 'c', 'd' 'a', 'b', 'c', 'd' on the x-axis with data points at 'a','c','a','c'.
From figure-Edit-Axes properties i know it must have some thing to do with axes ticks, which are set to auto, which means in my case tick locations step by 0.5 instead of 1.

How can I change x tick locations to 1 for good.

thanks in advance

Ben

Subject: XTickLabel

From: Grzegorz Knor

Date: 24 Sep, 2010 11:25:07

Message: 2 of 3

Ben <benvoeveren@gmail.com> wrote in message <134180684.107432.1285326540952.JavaMail.root@gallium.mathforum.org>...
> Hello,
>
> I would like to make a graph with XTickLabels.
>
> For example I have 4 data points
> y = [1:4];
>
> On the x-axis I want
> 'a', 'b', 'c', 'd' instead of 1,2,3,4
>
> the problem:
> it returns 'a', 'b', 'c', 'd' 'a', 'b', 'c', 'd' on the x-axis with data points at 'a','c','a','c'.
> From figure-Edit-Axes properties i know it must have some thing to do with axes ticks, which are set to auto, which means in my case tick locations step by 0.5 instead of 1.
>
> How can I change x tick locations to 1 for good.
>
> thanks in advance
>
> Ben

plot(1:4)
grid on
set(gca,'Xtick',1:4,'XTickLabel',{'a', 'b', 'c', 'd'})

?

regards

Subject: XTickLabel

From: Ben

Date: 24 Sep, 2010 12:08:16

Message: 3 of 3

thanks, I was just answering your question :)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us