Skip to content

Commit cb50cfe

Browse files
Add test for surface plot data
1 parent 1d4e83e commit cb50cfe

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

plotly/Test_plotlyfig.m

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,46 @@ function testScatter3DPlotData(tc)
267267
));
268268
end
269269

270+
function testSurfacePlotData(tc)
271+
fig = figure("Visible","off");
272+
points = linspace(-2, 2, 40);
273+
[x, y] = meshgrid(points, points);
274+
z = 2./exp((x-0.5).^2+y.^2)-2./exp((x+0.5).^2+y.^2);
275+
surf(x, y, z)
276+
277+
p = plotlyfig(fig,"visible","off");
278+
279+
tc.verifyNumElements(p.data, 1);
280+
tc.verifyEqual(rmfield(p.data{1}, ["colorscale" "surfacecolor"]), struct( ...
281+
"xaxis", "x1", ...
282+
"yaxis", "y1", ...
283+
"type", 'surface', ...
284+
"x", x, ...
285+
"y", y, ...
286+
"z", z, ...
287+
"contours", struct( ...
288+
"x", struct( ...
289+
"start", -2, ...
290+
"end", 2, ...
291+
"size", 0.102564102564103, ...
292+
"show", true, ...
293+
"color", 'black' ...
294+
), ...
295+
"y", struct( ...
296+
"start", -2, ...
297+
"end", 2, ...
298+
"size", 0.102564102564103, ...
299+
"show", true, ...
300+
"color", 'black' ...
301+
) ...
302+
), ...
303+
"name", '', ...
304+
"showscale", false, ...
305+
"visible", true, ...
306+
"showlegend", true ...
307+
), AbsTol=1e-15);
308+
end
309+
270310
function testPolarPlotData(tc)
271311
fig = figure("Visible","off");
272312
t = 0:0.01:2*pi;

0 commit comments

Comments
 (0)