help-octave
[Top][All Lists]

## Re: controlling plotting style (latex terminal)

 From: John W. Eaton Subject: Re: controlling plotting style (latex terminal) Date: Wed, 8 Jan 2003 23:32:41 -0600

```On  8-Jan-2003, Henry F. Mollet <address@hidden> wrote:

| Can you please explain a little more:
| 1. GNUPLOT:
| Terminal type set to 'aqua'
| gnuplot> plot sin (x)
| In gnuplot this produces y = sin(x) using default x = (-10:?:10) (? Because
| I don't know what the default spacing is), default y from -1 to +1.
|
| 2. OCTAVE WITH GPLOT:
| octave:1> gplot sin(x)
| error: `x' undefined near line 1 column 11
| x = (-10:0.1:10)';
| (Complex Conjugate Transpose Operator "'" and ";" for suppression of output;
| I assume that Transpose Operator ".'" would work also)
| octave:2> gplot sin(x)
| Produces y = sin (x) with x = 0-200 but it must correspond to -10 to +10 and
| showing 20/6.28 = 3.2 full cycles. Default y is -1 to +1.

You are only plotting y values here, so the x values are assumed to be
the indices of the y vector, 0 to 200.  Perhaps you really want

gplot ([x,sin(x)])

or similar?  Note that the () are needed here, otherwise Octave's
parser will think you are trying to specify plot ranges.

| 3. OCTAVE WITH MATLAB-LIKE plot(y):

| octave:5> plot (sin(x))
| Again x has to be defined but was already defined above. Almost identical
| results as in 2.  X-axis goes from 0-250 but sin (x) is only drawn as far as
| 200. Default y is -1 to +1.

Same as above, you are only plotting y values.  You probably want

plot (x, sin(x))

| 4. The Octave manual defines "gplot" as a low-level (plotting) function and
| "MATLAB-like-plot" as a higher-level plotting function. Gnuplot handles the
| actual graphics in both cases, so what does "low-level" and "higher-level"
| refer to?

Currently, plot and other Matlab-like plotting functions are defined
in terms of gplot, gset, etc.

jwe

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```