diff --git a/plotly/plotlyfig.m b/plotly/plotlyfig.m index 81236767..9b740525 100644 --- a/plotly/plotlyfig.m +++ b/plotly/plotlyfig.m @@ -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 diff --git a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m index 251bc708..fc64e824 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m @@ -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)]; @@ -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-% @@ -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 %-------------------------------------------------------------------------%