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:
How do I set XTick as a vector of NOT increasing values?

Subject: How do I set XTick as a vector of NOT increasing values?

From: Camille Couzi

Date: 28 Nov, 2011 03:20:08

Message: 1 of 2

Hello!
I am plotting a matrix of values on a polar plot, as the rows of my matrix A are frequencies and the columns are directions.
if my vector of frequencies is [ 0.1 0.2 0.3 0.4] for example, the automatic Xticks and Yticks on the polar plot generated are [-0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4], which is of course wrong, it should be [0.4 0.3 0.2 0.1 0 0.1 0.2 0.3 0.4] (same but without the "-").

I have tried to write:

set(myaxes,'YTick',abs(get(myaxes,'YTick')));
but it sends me the following error:

??? Error using ==> set
Values must be monotonically increasing

Any idea of how to solve this problem?
Thanks a lot in advance!!

Subject: How do I set XTick as a vector of NOT increasing values?

From: Bruno Luong

Date: 28 Nov, 2011 07:54:09

Message: 2 of 2

"Camille Couzi" <cco@dhi.com.sg> wrote in message <jauul8$29c$1@newscl01ah.mathworks.com>...
> Hello!
> I am plotting a matrix of values on a polar plot, as the rows of my matrix A are frequencies and the columns are directions.
> if my vector of frequencies is [ 0.1 0.2 0.3 0.4] for example, the automatic Xticks and Yticks on the polar plot generated are [-0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4], which is of course wrong, it should be [0.4 0.3 0.2 0.1 0 0.1 0.2 0.3 0.4] (same but without the "-").
>
> I have tried to write:
>
> set(myaxes,'YTick',abs(get(myaxes,'YTick')));
> but it sends me the following error:
>

You must change the label, not the tick:

plot(-4:4,rand(1,9))
set(gca,'xticklabel', arrayfun(@num2str,abs(get(gca,'xtick')),'unif',false))

Bruno

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