Thread Subject: Changing XTick Labels

Subject: Changing XTick Labels

From: julie KRATZ

Date: 19 Aug, 2009 12:28:01

Message: 1 of 3

Hello Everybody!

I guess this is a very simple question:

I have the following figure, which works out fine:

figure
bar( PCTNG_SH_first, 'k')
axis ([1 51 0 1])
hold on
bar( PCTNG_SH_first_right, 'b')
hold on
bar( PCTNG_SH_first_hit, 'r')
hold off

Now I just want to change/convert the number lables on the X-axes. Instead of ranging from 1:51 in increments of 1, I want the X-Axis Tick lables to be displayes from 1:1.05 in increments of .001.

I tried playing around with set(gca,'XTickLabel',['1';'1,001';'1,05'])...
and the axis command, but I did not get it.

I would be glad if one of you could help me with this!

Thanks

Julie

Subject: Changing XTick Labels

From: Shanmugam Kannappan

Date: 19 Aug, 2009 12:47:03

Message: 2 of 3

"julie KRATZ" <kratz@mpib-berlin.mpg.de> wrote in message <h6gr4g$pfc$1@fred.mathworks.com>...
> Hello Everybody!
>
> I guess this is a very simple question:
>
> I have the following figure, which works out fine:
>
> figure
> bar( PCTNG_SH_first, 'k')
> axis ([1 51 0 1])
> hold on
> bar( PCTNG_SH_first_right, 'b')
> hold on
> bar( PCTNG_SH_first_hit, 'r')
> hold off
>
> Now I just want to change/convert the number lables on the X-axes. Instead of ranging from 1:51 in increments of 1, I want the X-Axis Tick lables to be displayes from 1:1.05 in increments of .001.
>
> I tried playing around with set(gca,'XTickLabel',['1';'1,001';'1,05'])...
> and the axis command, but I did not get it.
>
> I would be glad if one of you could help me with this!
>
> Thanks
>
> Julie
Hi!

Just type the expression itself.
Ex:
set(gca,'XTickLabel',1:.001:1.05);

Shan...

Subject: Changing XTick Labels

From: julie KRATZ

Date: 19 Aug, 2009 17:33:22

Message: 3 of 3

"Shanmugam Kannappan" <shanmugambe@gmail.com> wrote in message <h6gs87$j22$1@fred.mathworks.com>...
> "julie KRATZ" <kratz@mpib-berlin.mpg.de> wrote in message <h6gr4g$pfc$1@fred.mathworks.com>...
> > Hello Everybody!
> >
> > I guess this is a very simple question:
> >
> > I have the following figure, which works out fine:
> >
> > figure
> > bar( PCTNG_SH_first, 'k')
> > axis ([1 51 0 1])
> > hold on
> > bar( PCTNG_SH_first_right, 'b')
> > hold on
> > bar( PCTNG_SH_first_hit, 'r')
> > hold off
> >
> > Now I just want to change/convert the number lables on the X-axes. Instead of ranging from 1:51 in increments of 1, I want the X-Axis Tick lables to be displayes from 1:1.05 in increments of .001.
> >
> > I tried playing around with set(gca,'XTickLabel',['1';'1,001';'1,05'])...
> > and the axis command, but I did not get it.
> >
> > I would be glad if one of you could help me with this!
> >
> > Thanks
> >
> > Julie
> Hi!
>
> Just type the expression itself.
> Ex:
> set(gca,'XTickLabel',1:.001:1.05);
>
> Shan...

Hello Shan!

I tried this already but it does not work.
on the x axis there are 51 bars and bar one should get the value 1, bar 2 the value 1.001,..., bar 51 = value 1.05.
If I use your command 1.001 appears at the 10th bar instead of labeling the second bar on the x axis. And bar 51 gets the value of 1.0051 instead of 1.5.

Maybe you know a different way to getting matlab to display the x axis in the desired format

Best

Julie

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
xtick labels Sprinceana 22 Aug, 2009 05:26:26
change labels Sprinceana 22 Aug, 2009 05:26:26
xtick Sprinceana 22 Aug, 2009 05:26:26
rssFeed for this Thread

Contact us at files@mathworks.com