Skip to content

Commit b64e170

Browse files
fix issue #240
1 parent 454aeca commit b64e170

File tree

3 files changed

+142
-5
lines changed

3 files changed

+142
-5
lines changed

plotly/plotlyfig.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ function validate(obj)
642642
updateAxis(obj,n);
643643
catch
644644
% TODO to the future
645-
disp('warning: error in updateAxis')
645+
disp('catch at line 643 in plotlyfog.m file')
646646
end
647647
end
648648

@@ -657,7 +657,7 @@ function validate(obj)
657657
end
658658
catch
659659
% TODO to the future
660-
disp('warning: error using update_opac')
660+
disp('catch at line 660 in plotlyfog.m file')
661661
end
662662

663663
end
@@ -668,7 +668,7 @@ function validate(obj)
668668
updateAnnotation(obj,n);
669669
catch
670670
% TODO to the future
671-
disp('warning: error in updateAnnotation')
671+
disp('catch at line 671 in plotlyfog.m file')
672672
end
673673
end
674674

@@ -972,7 +972,7 @@ function delete(obj)
972972
strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ...
973973
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
974974
|| strcmpi(fieldname,'scatterpolar') || strcmpi(fieldname,'barpolar') ...
975-
|| strcmpi(fieldname,'scene') ...
975+
|| strcmpi(fieldname,'scene') || strcmpi(fieldname,'layout') ...
976976
)
977977
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
978978
end

plotly/plotlyfig_aux/core/updateData.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
updatePie3(obj, dataIndex);
1212
elseif strcmpi(obj.PlotOptions.TreatAs, 'pcolor')
1313
updatePColor(obj, dataIndex);
14+
elseif strcmpi(obj.PlotOptions.TreatAs, 'polarplot')
15+
updatePolarplot(obj, dataIndex);
1416
end
1517

1618
%-update plot based on plot call class-%
@@ -150,7 +152,7 @@
150152
end
151153
catch
152154
% TODO to the future
153-
disp('waring: error in updateData at AXIS/DATA CLEAN UP section')
155+
disp('catch at line 155 in updateData.m file')
154156
end
155157

156158
%-------------------------------------------------------------------------%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
function updatePolarplot(obj,plotIndex)
2+
3+
%-------------------------------------------------------------------------%
4+
5+
%-Get plot class-%
6+
plotclass = obj.State.Plot(plotIndex).Class;
7+
8+
%-------------------------------------------------------------------------%
9+
10+
%-run the correct plot class-%
11+
if strcmpi(plotclass, 'line')
12+
updatePolarline(obj,plotIndex)
13+
elseif strcmpi(plotclass, 'polaraxes')
14+
updatePolaraxes(obj,plotIndex)
15+
end
16+
17+
%-------------------------------------------------------------------------%
18+
19+
end
20+
21+
22+
%-------------------------------------------------------------------------%
23+
%-HELPERS FUNCTIONS-%
24+
%-------------------------------------------------------------------------%
25+
26+
function updatePolaraxes(obj,plotIndex)
27+
28+
%-------------------------------------------------------------------------%
29+
30+
%-PLOT DATA STRUCTURE-%
31+
plot_data = get(obj.State.Plot(plotIndex).Handle);
32+
33+
%-------------------------------------------------------------------------%
34+
35+
%-setting polar axes-%
36+
gridcolor = 'rgb(235,235,235)';
37+
linecolor = 'rgb(210,210,210)';
38+
39+
%-R-axis-%
40+
obj.layout.polar.angularaxis.tickmode = 'array';
41+
obj.layout.polar.angularaxis.tickvals = plot_data.ThetaTick(1:end-1);
42+
obj.layout.polar.angularaxis.gridcolor = gridcolor;
43+
obj.layout.polar.angularaxis.linecolor = linecolor;
44+
obj.layout.polar.angularaxis.ticks = '';
45+
46+
%-Theta-axis-%
47+
obj.layout.polar.radialaxis.angle = plot_data.RAxisLocation;
48+
obj.layout.polar.radialaxis.tickmode = 'array';
49+
obj.layout.polar.radialaxis.tickvals = plot_data.RTick;
50+
obj.layout.polar.radialaxis.gridcolor = gridcolor;
51+
obj.layout.polar.radialaxis.showline = false;
52+
obj.layout.polar.radialaxis.tickangle = 90;
53+
obj.layout.polar.radialaxis.ticks = '';
54+
55+
%-------------------------------------------------------------------------%
56+
57+
end
58+
59+
function updatePolarline(obj,plotIndex)
60+
61+
%-------------------------------------------------------------------------%
62+
63+
%-PLOT DATA STRUCTURE- %
64+
plot_data = get(obj.State.Plot(plotIndex).Handle);
65+
66+
%-------------------------------------------------------------------------%
67+
68+
%-scatterpolar type-%
69+
obj.data{plotIndex}.type = 'scatterpolar';
70+
71+
%-------------------------------------------------------------------------%
72+
73+
%-scatter visible-%
74+
obj.data{plotIndex}.visible = strcmp(plot_data.Visible,'on');
75+
76+
%-------------------------------------------------------------------------%
77+
78+
%-scatter r-data-%
79+
obj.data{plotIndex}.r = abs(plot_data.RData);
80+
81+
%-------------------------------------------------------------------------%
82+
83+
%-scatter theta-data-%
84+
obj.data{plotIndex}.theta = rad2deg(plot_data.ThetaData);
85+
86+
%-------------------------------------------------------------------------%
87+
88+
%-scatterpolar name-%
89+
obj.data{plotIndex}.name = plot_data.DisplayName;
90+
91+
%-------------------------------------------------------------------------%
92+
93+
%-scatterpolar mode-%
94+
if ~strcmpi('none', plot_data.Marker) ...
95+
&& ~strcmpi('none', plot_data.LineStyle)
96+
mode = 'lines+markers';
97+
elseif ~strcmpi('none', plot_data.Marker)
98+
mode = 'markers';
99+
elseif ~strcmpi('none', plot_data.LineStyle)
100+
mode = 'lines';
101+
else
102+
mode = 'none';
103+
end
104+
105+
obj.data{plotIndex}.mode = mode;
106+
107+
%-------------------------------------------------------------------------%
108+
109+
%-scatter line-%
110+
obj.data{plotIndex}.line = extractLineLine(plot_data);
111+
obj.data{plotIndex}.line.width = 2 * obj.data{plotIndex}.line.width;
112+
113+
%-------------------------------------------------------------------------%
114+
115+
%-scatter marker-%
116+
obj.data{plotIndex}.marker = extractLineMarker(plot_data);
117+
118+
%-------------------------------------------------------------------------%
119+
120+
%-scatter showlegend-%
121+
leg = get(plot_data.Annotation);
122+
legInfo = get(leg.LegendInformation);
123+
124+
switch legInfo.IconDisplayStyle
125+
case 'on'
126+
showleg = true;
127+
case 'off'
128+
showleg = false;
129+
end
130+
131+
obj.data{plotIndex}.showlegend = showleg;
132+
133+
%-------------------------------------------------------------------------%
134+
135+
end

0 commit comments

Comments
 (0)