Slice NaNs showing strange behaviour

6 views (last 30 days)
John Atkinson
John Atkinson on 3 Dec 2014
Edited: John Atkinson on 3 Dec 2014
I have a 701 x 5 x 29 3D array (named V), produced from meshgrid and interp2. The data is good, i've checked through each layer and everything is in order (no data missing, monotonically spaced, and nans used for no data), the problem arises when I plot the data in slice, where the use of NaNs cuts the end of the data off (circled, bottom image).
If I replace the NaN's with zeros the data shows up, but then the issue is that the white isn't transparent (see attached). Here's the applicable code (removed axis labels etc)
V(isnan(V)) = 0; %uncomment and full lines are plotted
V_p = permute(V,[3 2 1]);
[XI3d,YI3d,ZI3d] = meshgrid(1:size(V_p,2),YI,XI); % all working
figure
slice(XI3d,YI3d,ZI3d,V_p, 1:5,0,0);
shading flat
set(gca(),'Zdir','reverse');
set(gca(),'xdir','reverse');
xlim([1 5]);
caxis([140 230]);
colormap([1,1,1;jet(64)]);
view(73,66)
So two part question: Is this just another Matlab quirk which you have to work around or is there a simple way to stop it? Is there an easy way to make one color within a color map transparent instead of the whole thing.
I've looked through Primitive but there's no obvious answer to the issue.
Cheers J
  6 Comments
Stephen23
Stephen23 on 3 Dec 2014
Edited: Stephen23 on 3 Dec 2014
Can you please edit your question to upload a .mat file of the data array, I would like to give this a try myself.
John Atkinson
John Atkinson on 3 Dec 2014
Uploaded. Also extra line added to code to put in same perspective.

Sign in to comment.

Answers (0)

Categories

Find more on 3-D Scene Control in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!