Skip to content

Commit d142141

Browse files
Fix polarhistogram
1 parent 6baa30e commit d142141

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

plotly/Test_plotlyfig.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,33 @@ function testHistogramPlotData(tc)
316316
), AbsTol=1e-15);
317317
end
318318

319+
function testPolarHistogramPlotData(tc)
320+
fig = figure("Visible","off");
321+
values = [0.6297 0.9559 0.7551 0.5261 0.8501 0.8160 0.1321 0.7607 0.6172 0.3976];
322+
polarhistogram(values);
323+
324+
p = plotlyfig(fig,"visible","off");
325+
326+
tc.verifyNumElements(p.data, 1);
327+
tc.verifyEqual(p.data{1}, struct( ...
328+
"type", 'barpolar', ...
329+
"r", [1 6 3 0], ...
330+
"width", [22.5 22.5 22.5 22.5], ...
331+
"theta", [11.25 33.75 56.25 78.75], ...
332+
"name", 'values', ...
333+
"marker", struct( ...
334+
"line", struct( ...
335+
"width", 0.5, ...
336+
"color", "rgba(0,0,0,1.000000)" ...
337+
), ...
338+
"color", "rgba(0,114,189,0.600000)" ...
339+
), ...
340+
"opacity", 0.6, ...
341+
"visible", true, ...
342+
"showlegend", true ...
343+
), AbsTol=1e-15);
344+
end
345+
319346
function testSingleBarPlotData(tc)
320347
fig = figure("Visible","off");
321348
bar(1,1);

plotly/plotlyfig_aux/core/updateData.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
updateContour3(obj, dataIndex);
1111
elseif ismember("ezpolar", lower(obj.PlotOptions.TreatAs))
1212
updateLineseries(obj, dataIndex);
13-
elseif ismember("polarhistogram", lower(obj.PlotOptions.TreatAs))
14-
updateHistogramPolar(obj, dataIndex);
1513
elseif ismember("coneplot", lower(obj.PlotOptions.TreatAs))
1614
updateConeplot(obj, dataIndex);
1715
elseif ismember("bar3", lower(obj.PlotOptions.TreatAs))
@@ -67,7 +65,11 @@
6765
case "categoricalhistogram"
6866
updateCategoricalHistogram(obj, dataIndex);
6967
case "histogram"
70-
updateHistogram(obj, dataIndex);
68+
if obj.State.Plot(dataIndex).AssociatedAxis.Type == "polaraxes"
69+
updateHistogramPolar(obj, dataIndex);
70+
else
71+
updateHistogram(obj, dataIndex);
72+
end
7173
case "histogram2"
7274
updateHistogram2(obj, dataIndex);
7375
case "patch"

0 commit comments

Comments
 (0)