Thread Subject: XTickLabel / YTickLabel adjusts wrong

Subject: XTickLabel / YTickLabel adjusts wrong

From: Daniel

Date: 31 Oct, 2008 20:59:02

Message: 1 of 3

Hello,

I am fairly new to Matlab plotting and I have made a figure with multiple subplots using contourf and a 2dim matrix with values for each coordinate. If I do not set X or YTickLabel then Matlab automatically labels the axes by row or column indices. If I use
    set(axesHand,'XTickLabel',freqs);
    set(axesHand,'YTickLabel',levels);
where freqs and levels are 1000 to 24000 step 1000 and 0 to 70 step 5 respectively.

When I first plot I get correct values (1000...24000) on the Xaxis, but if I resize the figure window then the XTickLabels do not adjust properly and I am left with plots that have x tick labels of 1000 2000 3000 4000. I understand that Matlab may try to adjust the tick labels for space and display reasons, but this is just plain wrong. It uses the wrong tick values for the xaxis after I resize the figure! What am I doing wrong here? How can I specify the number of ticks and maintain the correct labels after resizing the figure?

Any help is greatly appreciated.

Subject: XTickLabel / YTickLabel adjusts wrong

From: Husam Aldahiyat

Date: 1 Nov, 2008 04:08:02

Message: 2 of 3

Use

    set(axesHand,'XTickLabel',freqs,'xtick',a);
    set(axesHand,'YTickLabel',levels,'ytick',b);

where a and b are vectors (or maybe cells I forgot) that have the same values as freqs and levels, respectively.

Subject: XTickLabel / YTickLabel adjusts wrong

From: Daniel

Date: 1 Nov, 2008 17:03:01

Message: 3 of 3

This worked! Thank you for your help!
-Dan

"Husam Aldahiyat" <numandina@gmail.com> wrote in message <gegkn2$683$1@fred.mathworks.com>...
> Use
>
> set(axesHand,'XTickLabel',freqs,'xtick',a);
> set(axesHand,'YTickLabel',levels,'ytick',b);
>
> where a and b are vectors (or maybe cells I forgot) that have the same values as freqs and levels, respectively.

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
xticklabel Daniel 31 Oct, 2008 17:00:20
yticklabel Daniel 31 Oct, 2008 17:00:20
rssFeed for this Thread

Contact us at files@mathworks.com