Skip to content

Commit 67016b6

Browse files
fix issue 241
1 parent edcf9b0 commit 67016b6

File tree

3 files changed

+124
-2
lines changed

3 files changed

+124
-2
lines changed

plotly/plotlyfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ function delete(obj)
945945
if ~( ...
946946
strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ...
947947
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
948-
|| strcmpi(fieldname,'scatterpolar') ...
948+
|| strcmpi(fieldname,'scatterpolar') || strcmpi(fieldname,'barpolar') ...
949949
)
950950
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
951951
end

plotly/plotlyfig_aux/core/updateData.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
case 'line'
1313
updateLineseries(obj, dataIndex);
1414
case 'histogram'
15-
updateHistogram(obj, dataIndex);
15+
if strcmpi(obj.State.Axis(dataIndex).Handle.Type, 'polaraxes')
16+
updateHistogramPolar(obj, dataIndex);
17+
else
18+
updateHistogram(obj, dataIndex);
19+
end
1620
case 'histogram2'
1721
updateHistogram2(obj, dataIndex);
1822
case 'patch'
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
function obj = updateHistogramPolar(obj,histIndex)
2+
3+
% x:...[DONE]
4+
% y:...[DONE]
5+
% histnorm:...[DONE]
6+
% name:...[DONE]
7+
% autobinx:...[DONE]
8+
% nbinsx:...[DONE]
9+
% xbins:...[DONE]
10+
% autobiny:...[DONE]
11+
% nbinsy:...[DONE]
12+
% ybins:...[DONE]
13+
% text:...[NOT SUPPORTED IN MATLAB]
14+
% error_y:...[HANDLED BY ERRORBARSERIES]
15+
% error_x:...[HANDLED BY ERRORBARSERIES]
16+
% opacity: --- [TODO]
17+
% xaxis:...[DONE]
18+
% yaxis:...[DONE]
19+
% showlegend:...[DONE]
20+
% stream:...[HANDLED BY PLOTLYSTREAM]
21+
% visible:...[DONE]
22+
% type:...[DONE]
23+
% orientation:...[DONE]
24+
25+
% MARKER:
26+
% color: ...[DONE]
27+
% size: ...[NA]
28+
% symbol: ...[NA]
29+
% opacity: ...[TODO]
30+
% sizeref: ...[NA]
31+
% sizemode: ...[NA]
32+
% colorscale: ...[NA]
33+
% cauto: ...[NA]
34+
% cmin: ...[NA]
35+
% cmax: ...[NA]
36+
% outliercolor: ...[NA]
37+
% maxdisplayed: ...[NA]
38+
39+
% MARKER LINE:
40+
% color: ...[DONE]
41+
% width: ...[DONE]
42+
% dash: ...[NA]
43+
% opacity: ...[TODO]
44+
% shape: ...[NA]
45+
% smoothing: ...[NA]
46+
% outliercolor: ...[NA]
47+
% outlierwidth: ...[NA]
48+
49+
%-------------------------------------------------------------------------%
50+
51+
%-AXIS INDEX-%
52+
axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis);
53+
54+
%-HIST DATA STRUCTURE- %
55+
hist_data = get(obj.State.Plot(histIndex).Handle);
56+
57+
%-------------------------------------------------------------------------%
58+
59+
%-barpolar type-%
60+
obj.data{histIndex}.type = 'barpolar';
61+
62+
%-------------------------------------------------------------------------%
63+
64+
%-barpolar data-%
65+
binedges = rad2deg(hist_data.BinEdges);
66+
obj.data{histIndex}.theta = binedges(1:end-1) + 0.5*diff(binedges);
67+
obj.data{histIndex}.width = diff(binedges);
68+
obj.data{histIndex}.r = double(hist_data.BinCounts);
69+
70+
%-------------------------------------------------------------------------%
71+
72+
%-hist name-%
73+
obj.data{histIndex}.name = hist_data.DisplayName;
74+
75+
%-------------------------------------------------------------------------%
76+
77+
%-layout barmode-%
78+
obj.layout.barmode = 'group';
79+
80+
%-------------------------------------------------------------------------%
81+
82+
%-hist line width-%
83+
obj.data{histIndex}.marker.line.width = hist_data.LineWidth;
84+
85+
%-------------------------------------------------------------------------%
86+
87+
%-hist opacity-%
88+
if ~ischar(hist_data.FaceAlpha)
89+
obj.data{histIndex}.opacity = hist_data.FaceAlpha;
90+
end
91+
92+
%-------------------------------------------------------------------------%
93+
94+
obj.data{histIndex}.marker = extractPatchFace(hist_data);
95+
96+
%-------------------------------------------------------------------------%
97+
98+
%-hist visible-%
99+
obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on');
100+
101+
%-------------------------------------------------------------------------%
102+
103+
%-hist showlegend-%
104+
leg = get(hist_data.Annotation);
105+
legInfo = get(leg.LegendInformation);
106+
107+
switch legInfo.IconDisplayStyle
108+
case 'on'
109+
showleg = true;
110+
case 'off'
111+
showleg = false;
112+
end
113+
114+
obj.data{histIndex}.showlegend = showleg;
115+
116+
%-------------------------------------------------------------------------%
117+
118+
end

0 commit comments

Comments
 (0)