Skip to content

fix issue #191 #222

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
Jul 29, 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
186 changes: 76 additions & 110 deletions plotly/plotlyfig_aux/handlegraphics/updateScatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,117 +96,83 @@ function updateScatter(obj,scatterIndex)

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

%-scatter patch data-%
for m = 1:length(scatter_data)

%reverse counter
n = length(scatter_data) - m + 1;

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

%-scatter x-%
if length(scatter_data) > 1
obj.data{scatterIndex}.x(m) = scatter_data(n).XData;
else
obj.data{scatterIndex}.x = scatter_data.XData;
end

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

%-scatter y-%
if length(scatter_data) > 1
obj.data{scatterIndex}.y(m) = scatter_data(n).YData;
else
obj.data{scatterIndex}.y = scatter_data.YData;
end

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

%-scatter z-%
if isHG2()
if isfield(scatter_data,'ZData')
if any(scatter_data.ZData)
if length(scatter_data) > 1
obj.data{scatterIndex}.z(m) = scatter_data(n).ZData;
else
obj.data{scatterIndex}.z = scatter_data.ZData;
end
% overwrite type
obj.data{scatterIndex}.type = 'scatter3d';
end
end
end

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

%-scatter showlegend-%
leg = get(scatter_data.Annotation);
legInfo = get(leg.LegendInformation);

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

obj.data{scatterIndex}.showlegend = showleg;

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

%-scatter marker-%
childmarker = extractScatterMarker(scatter_data(n));

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

%-line color-%
if length(scatter_data) > 1
obj.data{scatterIndex}.marker.line.color{m} = childmarker.line.color{1};
else
obj.data{scatterIndex}.marker.line.color = childmarker.line.color;
end

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

%-marker color-%
if length(scatter_data) > 1
obj.data{scatterIndex}.marker.color{m} = childmarker.color{1};
else
obj.data{scatterIndex}.marker.color = childmarker.color;
end

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

%-sizeref-%
obj.data{scatterIndex}.marker.sizeref = childmarker.sizeref;

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

%-sizemode-%
obj.data{scatterIndex}.marker.sizemode = childmarker.sizemode;

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

%-symbol-%
obj.data{scatterIndex}.marker.symbol{m} = childmarker.symbol;

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

%-size-%
obj.data{scatterIndex}.marker.size = childmarker.size;

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

%-line width-%

if length(scatter_data) > 1 || ischar(childmarker.line.color)
obj.data{scatterIndex}.marker.line.width(m) = childmarker.line.width;
else
obj.data{scatterIndex}.marker.line.width(1:length(childmarker.line.color)) = childmarker.line.width;

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

%-scatter x-%
obj.data{scatterIndex}.x = scatter_data.XData;

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

%-scatter y-%
obj.data{scatterIndex}.y = scatter_data.YData;

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

%-scatter z-%
if isHG2()
if isfield(scatter_data,'ZData')
obj.data{scatterIndex}.type = 'scatter3d';
obj.data{scatterIndex}.z = scatter_data.ZData;
end

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

end

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

%-scatter showlegend-%
leg = get(scatter_data.Annotation);
legInfo = get(leg.LegendInformation);

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

obj.data{scatterIndex}.showlegend = showleg;

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

%-scatter marker-%
childmarker = extractScatterMarker(scatter_data);

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

%-line color-%
obj.data{scatterIndex}.marker.line.color = childmarker.line.color;

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

%-marker color-%
obj.data{scatterIndex}.marker.color = childmarker.color;

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

%-sizeref-%
obj.data{scatterIndex}.marker.sizeref = childmarker.sizeref;

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

%-sizemode-%
obj.data{scatterIndex}.marker.sizemode = childmarker.sizemode;

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

%-symbol-%
obj.data{scatterIndex}.marker.symbol = childmarker.symbol;

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

%-size-%
obj.data{scatterIndex}.marker.size = childmarker.size*0.1;

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

%-line width-%
obj.data{scatterIndex}.marker.line.width = childmarker.line.width;

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

end

5 changes: 5 additions & 0 deletions plotly/plotlyfig_aux/helpers/extractScatterMarker.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
markercolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];

end
markercolor = markercolor{1}
end
end

Expand Down Expand Up @@ -175,6 +176,8 @@
markerlinecolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];

end

markerlinecolor = markerlinecolor{1}

end
end
Expand All @@ -190,6 +193,8 @@
markerlinecolor{n} = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];

end

markerlinecolor = markerlinecolor{1};
end
end

Expand Down