Problem with plotting individual CData on triangular mesh

1 view (last 30 days)
I am having an issue with plotting a triangular surface with individual CData face colors. My CData contains NaN, as well as integer values (non scaled).
Here is the code I am using:
figure;
f1 = patch('Faces',faces,'Vertices',vertices);
set(f1,'FaceColor','flat','FaceVertexCData',CData,'CDataMapping','scaled');
When the figure window opens, I see an uncolored wire mesh of my object.
Interestingly, if I add the following lines:
hold on;
plot3(vertices(:,1), vertices(:,2), vertices(:,3), 'k.')
All of a sudden my colored faces show up, but I don't want the plotted vertices! If I turn them off manually using the property editor, my face colors disappear.
Does anyone know what's going on here? What am I missing?
Thanks, Erin

Answers (2)

Titus Edelhofer
Titus Edelhofer on 1 Sep 2011
Hi Erin,
just guessing, since I have no MATLAB available right now. It could be the renderer: try
set(gcf, 'renderer', 'zbuffer')
after creating the patch....?
Titus

Erin
Erin on 1 Sep 2011
Yes, this worked like a charm. Thanks!

Tags

Products

Community Treasure Hunt

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

Start Hunting!