|
From: sfeam (E. Merritt) <eam...@gm...> - 2012-10-08 00:04:02
|
On Sunday, 07 October 2012, Petr Mikulik wrote:
> > However, the pm3d code currently treats NaN as if it were zero anyhow,
> > so as a practical matter the plot would not come out any different.
> >
> > The "with image" plot modes recognize NaN and do not draw the corresponding
> > rectangular pixel. Should we make pm3d do the same?
> > I haven't looked to see how much work that would be.
>
> I have tried
> set view map; splot 'a.dat' with pm3d
> and
> plot 'a.dat' with image
> and it was the pm3d style which skipped the point, not the image style -- thus
> the opposite observation.
Very interesting. Those were not the test cases I tried.
For image plots I had in mind the examples in 'imageNaN.dem',
which plot using the commands
plot $matrixdata matrix with image # NaN pixel is omitted
set view map
splot $matrixdata matrix with image # NaN pixel is omitted
While for the pm3d plots I used the last plot in "pm3d.dem"
after modifying Dima's new harmean4() function to return NaN
when appropriate.
You are absolutely right that the simpler non-matix
'plot with image' command also needs fixing.
> Isn't it gnuplot who does not read it properly?
It seems so.
Image data is read properly in matrix mode but not (it seems)
in non-matrix mode.
I do not understand why your pm3d example works but mine
does not. From inspection of the code in pm3d.c I see no
special case for NaN pixel values, so how does it ever work?
I had been thinking that a new test would be needed,
like this:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -911,10 +914,11 @@ pm3d_plot(struct surface_points *this_pl
if (pm3d.direction != PM3D_DEPTH) {
if (color_from_rgbvar)
- set_rgbcolor(gray);
+ set_rgbcolor((unsigned int)gray);
else
set_color(gray);
- filled_quadrangle(corners);
+ if (!isnan(gray))
+ filled_quadrangle(corners);
} else {
/* copy quadrangle */
quadrangle* qp = quadrangles + current_quadrangle;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Yet your example works even without this change. How?
Clearly I need to stare at this some more.
Ethan
> with
>
> 0 0 0
> 0 1 -1
> 0 2 -4
> 0 3 -9
>
> 1 0 1
> 1 1 0
> 1 2 -3
> 1 3 -8
>
> 2 0 4
> 2 1 3
> 2 2 0
> 2 3 -5
>
> 3 0 9
> 3 1 8
> 3 2 NaN
> 3 3 9
>
>
> ---
> Petr
>
|