pcolor and "interp"

Ben Abbott bpabbott at mac.com
Wed Sep 24 05:42:12 CDT 2008


On Sep 24, 2008, at 1:38 AM, Kai Habel wrote:

> Ben Abbott schrieb:
>> 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
>>
> I see the same effect with the recently released gnuplot 4.2.4. If you
> look at __go_draw_axes__.m you find some remains from my attempt to
> implement the interp mode. Look for "Interp_str" which is currently  
> set
> to an empty string.
>
> Kai

I saw that and wondered who had worked on it.

As the pcolor has the setting below

	set view map;

I was thinking of checking for facecolor==interp, view==map and  
object==surface to determine when these changes are appropriate.

Is there a more proper way to determine when to (1) set "interp_str",  
(2) drop "($3)", and (3) not specify "zrange"?

Ben





More information about the Bug-octave mailing list