From help-octave-request at bevo dot che dot wisc dot edu Thu Apr 24 07:15:26 2003 Subject: Re: contour changes the number of levels (string size bug) From: "Niels L.Ellegaard" To: help-octave at bevo dot che dot wisc dot edu Date: Wed, 23 Apr 2003 23:26:44 -0500 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. Here is the output. Note that for i>10, I got tmp = 1:10,N. tmp = 1.000000, 2.000000 tmp = 1.000000, 2.000000, 3.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000, 11.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000, 12.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000, 13.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000, 14.000000 tmp = 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000, 15.000000 command = gset cntrparam levels discrete 1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, 7.000000, 8.000000, 9.000000, 10.000000 ------------------------------------------------------------- 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 -------------------------------------------------------------