Skip to content

fixing issue #391 #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions plotly/plotlyfig_aux/handlegraphics/updateLineseries.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@ function updateLineseries(obj,plotIndex)
%-------------------------------------------------------------------------%

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

%-------------------------------------------------------------------------%

%-getting data-%
x = plotData.XData;
y = plotData.YData;
xData = plotData.XData;
yData = plotData.YData;

if isduration(xData), xData = datenum(xData); end
if isduration(yData), yData = datenum(yData); end

%-------------------------------------------------------------------------%

Expand Down Expand Up @@ -114,20 +117,20 @@ function updateLineseries(obj,plotIndex)
%-scatter x-%

if ispolar
r = sqrt(x.^2 + y.^2);
obj.data{plotIndex}.r = r;
rData = sqrt(x.^2 + y.^2);
obj.data{plotIndex}.r = rData;
else
obj.data{plotIndex}.x = x;
obj.data{plotIndex}.x = xData;
end

%-------------------------------------------------------------------------%

%-scatter y-%
if ispolar
theta = atan2(x,y);
obj.data{plotIndex}.theta = -(rad2deg(theta) - 90);
thetaData = atan2(xData,yData);
obj.data{plotIndex}.theta = -(rad2deg(thetaData) - 90);
else
obj.data{plotIndex}.y = plotData.YData;
obj.data{plotIndex}.y = yData;
end

%-------------------------------------------------------------------------%
Expand Down Expand Up @@ -190,12 +193,12 @@ function updateLineseries(obj,plotIndex)

switch legInfo.IconDisplayStyle
case 'on'
showleg = true;
showLeg = true;
case 'off'
showleg = false;
showLeg = false;
end

obj.data{plotIndex}.showlegend = showleg;
obj.data{plotIndex}.showlegend = showLeg;

%-------------------------------------------------------------------------%

Expand Down
6 changes: 3 additions & 3 deletions plotly/plotlyfig_aux/helpers/extractAxisData.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@
%=========================================================================%

%-get tick label data-%
tickValues = eval(sprintf('axisData.%sTick', axisName));
tickLabels = eval(sprintf('axisData.%sTickLabel', axisName));
tickValues = eval(sprintf('axisData.%sTick', axisName));
if isduration(tickValues), tickValues = datenum(tickValues); end

%-------------------------------------------------------------------------%

Expand All @@ -111,6 +112,7 @@

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

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


axis.tickmode = 'array';
axis.tickvals = tickValues;
axis.ticktext = tickLabels;
Expand All @@ -142,7 +143,6 @@
%-set tick labels by using only tick values-%
elseif ~isempty(tickValues) && isempty(tickLabels)

axis.showticklabels = true;
axis.tickmode = 'array';
axis.tickvals = tickValues;

Expand Down