Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0ac865

Browse files
Add function contour plot data test
1 parent c40ded3 commit b0ac865

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
@@ -755,6 +755,46 @@ function testContourPlotData(tc)
755755
), AbsTol=1e-16);
756756
end
757757

758+
function testFunctionContourPlotData(tc)
759+
fig = figure("Visible","off");
760+
fcontour(@(x,y) sin(3*x).*cos(x+y),[0 3 0 3],Fill="on",LineColor="k");
761+
chartTitle = "f(x,y) = sin(3*x)*cos(x+y)";
762+
title(chartTitle);
763+
colormap("spring");
764+
765+
p = plotlyfig(fig,"visible","off");
766+
767+
tc.verifyNumElements(p.data, 1);
768+
tc.verifyEqual(rmfield(p.data{1}, ["colorscale" "x" "y" "z"]), struct( ...
769+
"xaxis", "x1", ...
770+
"yaxis", "y1", ...
771+
"name", '{sin}({3} {x}) {cos}({x}+{y})', ...
772+
"type", 'contour', ...
773+
"visible", true, ...
774+
"xtype", 'array', ...
775+
"ytype", 'array', ...
776+
"autocontour", false, ...
777+
"contours", struct( ...
778+
"start", -1, ...
779+
"end", 0.8, ...
780+
"size", 0.2, ...
781+
"coloring", 'fill' ...
782+
), ...
783+
"zauto", false, ...
784+
"zmin", -1, ...
785+
"zmax", 0.8, ...
786+
"showscale", false, ...
787+
"reversescale", false, ...
788+
"line", struct( ...
789+
"width", 0.5, ...
790+
"dash", 'solid', ...
791+
"color", "rgb(0,0,0)", ...
792+
"smoothing", 0 ...
793+
), ...
794+
"showlegend", true ...
795+
), AbsTol=1e-2);
796+
end
797+
758798
function testStemPlotData(tc)
759799
fig = figure("Visible","off");
760800
x = 1:10;

0 commit comments

Comments
 (0)