help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: contourf


From: Paul Kienzle
Subject: Re: contourf
Date: Wed, 5 Apr 2006 06:47:47 -0400

On Apr 4, 2006, at 6:10 AM, Alexandre Ribeiro wrote:

Hi

I'm in trouble! In MatLab contourf is similar to contour, the only diference is that the first one is filled. In octave contourf is not working. I always have an error message.

Tanks for your help

Alexandre

octave:50> x=rand(10,10);
octave:51> contour(x)
octave:52> contour(x,5)
octave:53> contourf(x,5)
error: expecting integer index, found 13.600000
error: evaluating argument list element number 1
error: called from `contourf' in file `/usr/share/octave/site/m/octave-forge/plot/contourf.m'

contourf is an imaging hack. It's kind of cute, but without gnuplot4.1 which allows you to draw images with axes is is not very useful. If it were in use this bug would have been fixed long ago.

The following patch fixes the bug.

Try the following:

        C=colormap;colormap(rand(64,3));contourf(peaks(200));colormap(C);

- Paul

*** contourf.m  27 Nov 2002 08:40:11 -0000      1.3
--- contourf.m  5 Apr 2006 10:30:03 -0000       1.4
*************** function contourf(z,n,w)
*** 36,42 ****
    z(z!=fix(z)) = 0;

    ## plot the image, with the contours drawn in black.
!   colormap([0,0,0; C(linspace(1,rows(C),n+1),:)]);
    image(flipud(z)+1);

    ## restore the colormap
--- 36,42 ----
    z(z!=fix(z)) = 0;

    ## plot the image, with the contours drawn in black.
!   colormap([0,0,0; C(round(linspace(1,rows(C),n+1)),:)]);
    image(flipud(z)+1);

    ## restore the colormap



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]