matlab - matlab2tikz error plotting image with alphadata -
i plotting matrix ("i1") has nan values through imagesc command. can see in code have set such nan values should plotted in white
i = magic(10); i1 = nan(10); i1(4:6,4:6) = i(4:6,4:6); f1 = figure(); h = imagesc(i1); colormap jet; set(h,'alphadata',~isnan(i1)) axis tight; axis equal; axis on; matlab2tikz('file.tex')
i need convert such image in matlab2tikz (see indeed last line of script) obtain following error:
error using writepng>parseinputs (line 349) value of 'alpha' invalid. expected input 1 of these types:double, uint8, uint16
instead type logical.
can overcome problem? in advance
all have convert transparencies double
. right now, array of type logical
, transparency data can 1 of double, uint8
or uint16
. given nature of array, want non nan
visible while values nan
transparent, want 0/1
data, not true/false
.
simply convert double
after fact:
set(h,'alphadata',double(~isnan(i1)));
Comments
Post a Comment