MATLAB Answers

Iso-surface with two plots only plots in one color

5 views (last 30 days)
Nathaniel Werner
Nathaniel Werner on 12 Aug 2016
Edited: Geoff Hayes on 13 Aug 2016
I have the following function, that I use to plot two iso-surfaces from data collected in CFD. The only problem is that it does not plot both colors, only gray. This works perfectly in newer versions of MatLab so my guess is that that is the main problem.
Here is my function.
function [ p ] = draw_isosurface(xBox,yBox,zBox,component,iso_plus,iso_minus,plus_color,minus_color)
%Draw 2 isosurfaces about the input values in the same figure
% <Input>
% xBox, yBox, zBox: X,Y,Z in 3D
% component: The thing you want to look at
% iso_plus, iso_minus: Positive and Negative value of iso-value.
% plus_color, minus_color: Name of the color or RGB code of isosurfaces
p=patch(isosurface(xBox,yBox,zBox,squeeze(component),iso_plus));
p.FaceColor = plus_color; p.EdgeColor = 'none';
alpha(.5)
camlight
lighting gouraud
hold on
p=patch(isosurface(xBox,yBox,zBox,squeeze(component),iso_minus));
p.FaceColor = minus_color;
p.EdgeColor = 'none';
alpha(.5)
camlight
lighting gouraud
grid on
axis equal
end
I am currently using version 2012a but I'm curious if there is a problem with my function.
%

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!