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

Skip to content

Commit ef95b87

Browse files
fixing issue #391
1 parent 049a778 commit ef95b87

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

plotly/plotlyfig_aux/handlegraphics/updateLineseries.m

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@ function updateLineseries(obj,plotIndex)
7676
%-------------------------------------------------------------------------%
7777

7878
%-if polar plot or not-%
79-
treatas = obj.PlotOptions.TreatAs;
80-
ispolar = ismember('compass', lower(treatas)) || ismember('ezpolar', lower(treatas));
79+
treatAs = obj.PlotOptions.TreatAs;
80+
ispolar = ismember('compass', lower(treatAs)) || ismember('ezpolar', lower(treatAs));
8181

8282
%-------------------------------------------------------------------------%
8383

8484
%-getting data-%
85-
x = plotData.XData;
86-
y = plotData.YData;
85+
xData = plotData.XData;
86+
yData = plotData.YData;
87+
88+
if isduration(xData), xData = datenum(xData); end
89+
if isduration(yData), yData = datenum(yData); end
8790

8891
%-------------------------------------------------------------------------%
8992

@@ -114,20 +117,20 @@ function updateLineseries(obj,plotIndex)
114117
%-scatter x-%
115118

116119
if ispolar
117-
r = sqrt(x.^2 + y.^2);
118-
obj.data{plotIndex}.r = r;
120+
rData = sqrt(x.^2 + y.^2);
121+
obj.data{plotIndex}.r = rData;
119122
else
120-
obj.data{plotIndex}.x = x;
123+
obj.data{plotIndex}.x = xData;
121124
end
122125

123126
%-------------------------------------------------------------------------%
124127

125128
%-scatter y-%
126129
if ispolar
127-
theta = atan2(x,y);
128-
obj.data{plotIndex}.theta = -(rad2deg(theta) - 90);
130+
thetaData = atan2(xData,yData);
131+
obj.data{plotIndex}.theta = -(rad2deg(thetaData) - 90);
129132
else
130-
obj.data{plotIndex}.y = plotData.YData;
133+
obj.data{plotIndex}.y = yData;
131134
end
132135

133136
%-------------------------------------------------------------------------%
@@ -190,12 +193,12 @@ function updateLineseries(obj,plotIndex)
190193

191194
switch legInfo.IconDisplayStyle
192195
case 'on'
193-
showleg = true;
196+
showLeg = true;
194197
case 'off'
195-
showleg = false;
198+
showLeg = false;
196199
end
197200

198-
obj.data{plotIndex}.showlegend = showleg;
201+
obj.data{plotIndex}.showlegend = showLeg;
199202

200203
%-------------------------------------------------------------------------%
201204

plotly/plotlyfig_aux/helpers/extractAxisData.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@
8383
%=========================================================================%
8484

8585
%-get tick label data-%
86-
tickValues = eval(sprintf('axisData.%sTick', axisName));
8786
tickLabels = eval(sprintf('axisData.%sTickLabel', axisName));
87+
tickValues = eval(sprintf('axisData.%sTick', axisName));
88+
if isduration(tickValues), tickValues = datenum(tickValues); end
8889

8990
%-------------------------------------------------------------------------%
9091

@@ -111,6 +112,7 @@
111112

112113
%-some tick label settings-%
113114
axisLim = eval( sprintf('axisData.%sLim', axisName) );
115+
if isduration(axisLim), axisLim = datenum(axisLim); end
114116

115117
switch axisData.Box
116118
case 'on'
@@ -132,7 +134,6 @@
132134
%-set tick labels by using tick values and tick texts-%
133135
if ~isempty(tickValues) && ~isempty(tickLabels)
134136

135-
136137
axis.tickmode = 'array';
137138
axis.tickvals = tickValues;
138139
axis.ticktext = tickLabels;
@@ -142,7 +143,6 @@
142143
%-set tick labels by using only tick values-%
143144
elseif ~isempty(tickValues) && isempty(tickLabels)
144145

145-
axis.showticklabels = true;
146146
axis.tickmode = 'array';
147147
axis.tickvals = tickValues;
148148

0 commit comments

Comments
 (0)