Thu 26 Sep 2013 07:45:25 PM UTC, original submission:
If a matrix containing a NaN is plotted with pcolor, the corresponding grid cell is black, while in matlab such elements are not plotted (they appear white since the default background is white).
If the plot is saved as an EPS file, the resulting file containts a "nan" and cannot be opened by ghostscript (which is used to create a PNG file for example).
The following command
pcolor([NaN 1 2; 3 4 5; 6 7 8])
print -dpng test.png
creates thus an error:
Error: /undefined in nan
Operand stack:
--nostringval-- 74.88 223.56
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop --nostringval-- 1893 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:1167/1684(ro)(G)-- --dict:0/20(G)-- --dict:82/200(L)-- --dict:40/64(L)--
Current allocation mode is local
GPL Ghostscript 9.05: Unrecoverable error, exit code 1
I got this error for the current development version (changeset: 17497:96cf8ee3440e) and octave 3.6.4.
The special value "NA" produces the same error, but not Inf.
The code in gl-render.cc (function opengl_renderer::draw_surface) checks only if the grid arrays x,y or z contain a NaN. The attached patch adds additional checks. I have tested it with NaN and NA for flat and interpolated shading.
|