Skip to content

Commit 940abf1

Browse files
Add loglog plot test
1 parent 71f8ae3 commit 940abf1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

plotly/Test_plotlyfig.m

+39
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,45 @@ function testPolarHistogramPlotData(tc)
343343
), AbsTol=1e-15);
344344
end
345345

346+
function testLogLogPlot(tc)
347+
fig = figure("Visible","off");
348+
zeta = 0.5; % damping factor
349+
color = "r";
350+
w = logspace(-1, 1, 1000); % values equally spaced logarithmically
351+
a = w.^2 - 1;
352+
b = 2*w*zeta;
353+
gain = sqrt(1./(a.^2 + b.^2));
354+
loglog(w, gain, color=color);
355+
axis([0.1 10 0.01 100]);
356+
357+
p = plotlyfig(fig,"visible","off");
358+
359+
tc.verifyNumElements(p.data, 1);
360+
tc.verifyEqual(p.data{1}, struct( ...
361+
"type", "scatter", ...
362+
"xaxis", "x1", ...
363+
"yaxis", "y1", ...
364+
"name", '', ...
365+
"mode", 'lines', ...
366+
"x", w, ...
367+
"y", gain, ...
368+
"marker", struct( ...
369+
"size", 3.6, ...
370+
"line", struct( ...
371+
"width", 0.5 ...
372+
), ...
373+
"color", "rgb(255,0,0)" ...
374+
), ...
375+
"line", struct( ...
376+
"color", "rgb(255,0,0)", ...
377+
"width", 0.5, ...
378+
"dash", 'solid' ...
379+
), ...
380+
"visible", true, ...
381+
"showlegend", false ...
382+
), AbsTol=1e-15);
383+
end
384+
346385
function testSingleBarPlotData(tc)
347386
fig = figure("Visible","off");
348387
bar(1,1);

0 commit comments

Comments
 (0)