Skip to content

Commit

Permalink
fix issue #245
Browse files Browse the repository at this point in the history
  • Loading branch information
galvisgilberto committed Jul 31, 2021
1 parent db33f39 commit 6cd8dae
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions plotly/plotlyfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ function delete(obj)
if ~( ...
strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ...
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
|| strcmpi(fieldname,'scatterpolar') ...
)
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
end
Expand Down
30 changes: 28 additions & 2 deletions plotly/plotlyfig_aux/handlegraphics/updateLineseries.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ function updateLineseries(obj,plotIndex)

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

%-if compass or not-%
iscompass = false;
x = plot_data.XData;
y = plot_data.YData;

if length(x)==5 && length(y)==5 && x(2)==x(4) && y(2)==y(4)
iscompass = true;
end

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

%-scatter xaxis-%
obj.data{plotIndex}.xaxis = ['x' num2str(xsource)];

Expand All @@ -78,6 +89,10 @@ function updateLineseries(obj,plotIndex)
%-scatter type-%
obj.data{plotIndex}.type = 'scatter';

if iscompass
obj.data{plotIndex}.type = 'scatterpolar';
end

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

%-scatter visible-%
Expand All @@ -86,12 +101,23 @@ function updateLineseries(obj,plotIndex)
%-------------------------------------------------------------------------%

%-scatter x-%
obj.data{plotIndex}.x = plot_data.XData;

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

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

%-scatter y-%
obj.data{plotIndex}.y = plot_data.YData;
if iscompass
theta = atan2(x,y);
obj.data{plotIndex}.theta = -(rad2deg(theta) - 90);
else
obj.data{plotIndex}.y = plot_data.YData;
end

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

Expand Down

0 comments on commit 6cd8dae

Please sign in to comment.