help-octave
[Top][All Lists]

## Re: revised: How to set xtics in 2-D plot in Octave 3.0.0 on a PC with W

 From: John W. Eaton Subject: Re: revised: How to set xtics in 2-D plot in Octave 3.0.0 on a PC with Windows Vista Date: Thu, 28 Feb 2008 04:05:01 -0500

```On 28-Feb-2008, Tatsuro MATSUOKA wrote:

| Thanks Michael
|
| michael.goffioul
| >>  ************************************************************
| >>
| >>           ax=gca();
| >>           set (ax, "xtick", [pi/4, pi/2, pi, 1.5*pi, 2*pi])
| >>           set (ax, "xticklabelmode", "Manual")
| >
| >This should not be needed. Setting explicitely xticklabel switches
| >xticklabelmode to manual (idem for xlim, xtick...).
|
|
| I confirmed the following is OK.
| ******
| ax=gca();
| set (ax, "xtick", [pi/4, pi/2, pi, 1.5*pi, 2*pi]);
| set (ax, "xticklabel", ["Pi/4";"Pi/2";"Pi";"3*Pi/2";"2*Pi"]);
| *****
|
| The point is thar label strings should be give by a column verctor.

It's not really a column vector, it's a character matrix.

Notice that if you write

["Pi/4", "Pi/2", "Pi", "3*Pi/2", "2*Pi"]

the individual elements are all concatentated into a single character
string:

Pi/4Pi/2Pi3*Pi/22*Pi

Also, if you write

["Pi/4"; "Pi/2"; "Pi"; "3*Pi/2"; "2*Pi"]

each of the rows is padded with space characters so the size of the
resulting matrix is 5x6 (in Matlab you would have to pad the elements
with spaces yourself).  It is probably better and easier to use a cell
array instead.  Then you can use either one row or one column.  For
example,

set (ax, "xticklabel", {"Pi/4", "Pi/2", "Pi", "3*Pi/2", "2*Pi"});

should also work.

jwe

```