Skip to content

Commit 2bc5a2c

Browse files
Add IsosurfacePlot test
1 parent 8eef9f5 commit 2bc5a2c

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

plotly/Test_plotlyfig.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,41 @@ function testFunctionSurfacePlotData(tc)
15881588
));
15891589
end
15901590

1591+
function testIsosurfacePlotData(tc)
1592+
fig = figure("Visible","off");
1593+
[X,Y,Z] = meshgrid(linspace(-1,1,20),linspace(-1,1,20),linspace(-1,1,20));
1594+
V = X.^2 + Y.^2 + Z.^2;
1595+
isosurface(X,Y,Z,V,0.5);
1596+
1597+
plotData = fig.Children.Children(2);
1598+
p = plotlyfig(fig,"visible","off","treatAs",'isosurface');
1599+
1600+
tc.verifyNumElements(p.data, 1);
1601+
tc.verifyEqual(p.data{1}, struct( ...
1602+
"type", 'mesh3d', ...
1603+
"name", '', ...
1604+
"showscale", false, ...
1605+
"x", plotData.Vertices(:,1), ...
1606+
"y", plotData.Vertices(:,2), ...
1607+
"z", plotData.Vertices(:,3), ...
1608+
"i", plotData.Faces(:,1) - 1, ...
1609+
"j", plotData.Faces(:,2) - 1, ...
1610+
"k", plotData.Faces(:,3) - 1, ...
1611+
"color", "rgb(16,190,186)", ...
1612+
"lighting", struct( ...
1613+
"diffuse", 0.6, ...
1614+
"ambient", 0.3, ...
1615+
"specular", 0.9, ...
1616+
"roughness", 0.2, ...
1617+
"fresnel", 0.5, ...
1618+
"vertexnormalsepsilon", 1e-12, ...
1619+
"facenormalsepsilon", 1e-06 ...
1620+
), ...
1621+
"scene", 'scene1', ...
1622+
"showlegend", false ...
1623+
));
1624+
end
1625+
15911626
function testTitleFont(tc)
15921627
fig = figure("Visible","off");
15931628
x = 1:10;

plotly/plotlyfig_aux/handlegraphics/updateIsosurface.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function updateScene(obj, isoIndex)
140140
end
141141

142142
%-SET SCENE TO LAYOUT-%
143-
obj.layout.("scene" + xsource) = scene;
143+
obj.layout.("scene" + xSource) = scene;
144144
end
145145

146146
function fillColor = getFaceColor(plotData, axisData)

0 commit comments

Comments
 (0)