help-octave
[Top][All Lists]
Advanced

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

strnage behaviour of pcolor


From: Francesco Potorti`
Subject: strnage behaviour of pcolor
Date: Wed, 23 Jul 2008 14:26:31 +0200

This is a copy of a bug report sent to the Debian bug reporting system.
Since it contains a workaround that may be useful to others, I am
sending it here, too.

If you try
  pcolor(1:3,1:3,reshape(1:9,3,3))
you see that it only displays four colours.  In general, pcolor does not
display anything for the last row and column.  Those data are ignored as
far as plotting is concerned.  However, they are taken into account as
far as axis limits are concerned, both for ticks and for colors.  I
don't know if it is done for compatibility with Matlab.  Anyway, this
function corrects the problem when pcolor is called with vector X and
Y.  It also removes by default the black grid, which I do not like:

function mypcolor(x,y,z)
  x0=3*x(1)-x(2);xe=3*x(end)-x(end-1);xm=x(1:end-1)+x(2:end);x=[x0;xm(:);xe]/2;
  y0=3*y(1)-y(2);ye=3*y(end)-y(end-1);ym=y(1:end-1)+y(2:end);y=[y0;ym(:);ye]/2;
  z=[z,z(:,end);z(end,:),z(end,end)];
  pcolor(x,y,z);
  shading("flat");
endfunction


reply via email to

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