[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: contour changes the number of levels (string size bug)
From: 
John W. Eaton 
Subject: 
Re: contour changes the number of levels (string size bug) 
Date: 
Thu, 24 Apr 2003 07:20:18 0500 
On 23Apr2003, Niels L.Ellegaard <address@hidden> wrote:
 Thanks for the hints about contour.m.

 When I try to make a contour plot I cannot make more than 10 levels. I
 have been looking in the code and I think that the problem occurs because
 of a maximum string length. In order to prove this, I copied contour.m to
 my home directory and removed two semicolons. Afterwards line 88  96
 looked like this:

 if (is_scalar (n))
 command = sprintf ("gset cntrparam levels %d", n);
 elseif (is_vector (n))
 tmp = sprintf ("%f", n(1));
 for i = 2:length (n)
 tmp = sprintf ("%s, %f", tmp, n(i)) # colon is removed
 endfor
 command = sprintf ("gset cntrparam levels discrete %s", tmp) # same here
 endif

 I tried the following

 octave:1> x = y = [0:0.01:2];
 octave:2> z = sin(x' * y);
 octave:3> contour(x,y,z,[1:1:15])

 The resulting plot contained only levels 1:10.
What version of Octave are you using and on what system? With 2.1.46
I see what I think are correct results for
x = y = [0:0.01:2];
z = sin (x' * y);
contour (x, y, z, 0:0.05:1);
which produces 20 contours.
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
