pcolor and "interp"
Ben Abbott
bpabbott at mac.com
Tue Sep 23 21:34:58 CDT 2008
was Subject: Re: [changeset] clarification to pcolor doc-string
I've not yet attempted to change __go_draw_axes__.m, but I have been
able to determine what needs to be changed in the gnuplot stream for
the interpolation to work.
One qualifier; the result is not equivalent to Matlab, which uses a
bilinear interpolation, enabled by segmenting each rectangular cell
into a pair of triangles.
In any event, using gnuplot 4 lines of the stream need to be
modified. I'll use the short example supplied by jwe to demonstrate.
pcolor (peaks ());
shading interp
drawnow ("x11", "/dev/null", false, "debug.gp")
The 4 lines in debug.gp which require modification are listed below.
< 42 set pm3d explicit at s corners2color c3;
> 42 set pm3d explicit at s interpolate 2, 2 corners2color c3;
< 43 set pm3d explicit at s depthorder corners2color c3;
> 43 #set pm3d explicit at s depthorder corners2color c3;
44 set pm3d explicit;
45 unset hidden3d;
46 set xrange [-3.000000000000000e+00:3.000000000000000e+00]
noreverse;
47 set yrange [-3.000000000000000e+00:3.000000000000000e+00]
noreverse;
< 48 set zrange [-1.000000000000000e+00:1.000000000000000e+00]
noreverse;
> 48 #set zrange [-1.000000000000000e+00:1.000000000000000e+00]
noreverse;
[...]
< 62 splot "-" using ($1):($2):($3):($4) title "" with pm3d linestyle
1 \
> 62 splot "-" using ($1):($2):($4) title "" with pm3d linestyle 1 \
After making the changes, the result may be rendered by
gnuplot -persist debug.gp
The part, "interpolate 2, 2", increases the <steps in scan> and <steps
between scans>, respectively. In this instance I've increase each from
1 to 2. The general format for this is;
set pm3d interpolate <steps in scan>,<steps between scans>
I am not yet prepared to explain way the changes are needed for the
zrange or why ($3) needed to be removed. but I need to make each of
these changes to produce a proper result. I'm running gnuplot 4.2.3.
If some one is running a version of gnuplot more recent than v4.2.3,
I'd be interested is how it handles the result.
I'll look into __go_draw_axes__.m tomorrow, but if anyone has some
functional understanding of the details ... please jump in.
Ben
More information about the Bug-octave
mailing list