[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing 'xtick' to integer values of Pi.
From: |
Ben Abbott |
Subject: |
Re: Changing 'xtick' to integer values of Pi. |
Date: |
Sun, 27 Mar 2011 10:26:44 -0400 |
On Mar 27, 2011, at 9:14 AM, dirac wrote:
> Hi there,
>
> I was wondering if there is a way to change the numbering on the xaxis on a
> plot to integer values of pi/2. All I want to do is have a graph of cos(x)
> and label the critical points of [0:pi/2:2*pi] if that is possible. I have
> tried using the set(gca,"xticklabel",........) in various combinations but
> can"t work it out!
>
> Any help would be really appreciated.
> Thanks,
> MA
You'll need to set both xtick and xticklabel
x = (0:0.01:1)*2*pi;
plot (x, sin(x), x, cos(x))
set (gca, "xtick", [0:0.5:2]*pi)
set (gca, "xticklabel", {"0","\pi/2","\pi","3\pi/2","2\pi"})
Ben