Skip to content

Issue236 fixed stem3 #344

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 4 commits into from
Aug 17, 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
8 changes: 4 additions & 4 deletions plotly/plotlyfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ function validate(obj)
updateAxis(obj,n);
catch
% TODO to the future
disp('warning: error in updateAxis')
disp('catch at line 643 in plotlyfog.m file')
end
end

Expand All @@ -657,7 +657,7 @@ function validate(obj)
end
catch
% TODO to the future
disp('warning: error using update_opac')
disp('catch at line 660 in plotlyfog.m file')
end

end
Expand All @@ -668,7 +668,7 @@ function validate(obj)
updateAnnotation(obj,n);
catch
% TODO to the future
disp('warning: error in updateAnnotation')
disp('catch at line 671 in plotlyfog.m file')
end
end

Expand Down Expand Up @@ -972,7 +972,7 @@ function delete(obj)
strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ...
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
|| strcmpi(fieldname,'scatterpolar') || strcmpi(fieldname,'barpolar') ...
|| strcmpi(fieldname,'scene') ...
|| strcmpi(fieldname,'scene') || strcmpi(fieldname,'layout') ...
)
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
end
Expand Down
4 changes: 3 additions & 1 deletion plotly/plotlyfig_aux/core/updateData.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
updatePie3(obj, dataIndex);
elseif strcmpi(obj.PlotOptions.TreatAs, 'pcolor')
updatePColor(obj, dataIndex);
elseif strcmpi(obj.PlotOptions.TreatAs, 'polarplot')
updatePolarplot(obj, dataIndex);
end

%-update plot based on plot call class-%
Expand Down Expand Up @@ -150,7 +152,7 @@
end
catch
% TODO to the future
disp('waring: error in updateData at AXIS/DATA CLEAN UP section')
disp('catch at line 155 in updateData.m file')
end

%-------------------------------------------------------------------------%
Expand Down
8 changes: 7 additions & 1 deletion plotly/plotlyfig_aux/handlegraphics/updateLineseries.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ function updateLineseries(obj,plotIndex)

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

%-Fro 3D plots-%
obj.PlotOptions.is3d = false; % by default

if isfield(plot_data,'ZData')

numbset = unique(plot_data.ZData);
Expand All @@ -139,8 +142,11 @@ function updateLineseries(obj,plotIndex)
%-scatter z-%
obj.data{plotIndex}.z = plot_data.ZData;

%overwrite type
%-overwrite type-%
obj.data{plotIndex}.type = 'scatter3d';

%-flag to manage 3d plots-%
obj.PlotOptions.is3d = true;
end
end

Expand Down
135 changes: 135 additions & 0 deletions plotly/plotlyfig_aux/handlegraphics/updatePolarplot.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
function updatePolarplot(obj,plotIndex)

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

%-Get plot class-%
plotclass = obj.State.Plot(plotIndex).Class;

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

%-run the correct plot class-%
if strcmpi(plotclass, 'line')
updatePolarline(obj,plotIndex)
elseif strcmpi(plotclass, 'polaraxes')
updatePolaraxes(obj,plotIndex)
end

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

end


%-------------------------------------------------------------------------%
%-HELPERS FUNCTIONS-%
%-------------------------------------------------------------------------%

function updatePolaraxes(obj,plotIndex)

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

%-PLOT DATA STRUCTURE-%
plot_data = get(obj.State.Plot(plotIndex).Handle);

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

%-setting polar axes-%
gridcolor = 'rgb(235,235,235)';
linecolor = 'rgb(210,210,210)';

%-R-axis-%
obj.layout.polar.angularaxis.tickmode = 'array';
obj.layout.polar.angularaxis.tickvals = plot_data.ThetaTick(1:end-1);
obj.layout.polar.angularaxis.gridcolor = gridcolor;
obj.layout.polar.angularaxis.linecolor = linecolor;
obj.layout.polar.angularaxis.ticks = '';

%-Theta-axis-%
obj.layout.polar.radialaxis.angle = plot_data.RAxisLocation;
obj.layout.polar.radialaxis.tickmode = 'array';
obj.layout.polar.radialaxis.tickvals = plot_data.RTick;
obj.layout.polar.radialaxis.gridcolor = gridcolor;
obj.layout.polar.radialaxis.showline = false;
obj.layout.polar.radialaxis.tickangle = 90;
obj.layout.polar.radialaxis.ticks = '';

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

end

function updatePolarline(obj,plotIndex)

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

%-PLOT DATA STRUCTURE- %
plot_data = get(obj.State.Plot(plotIndex).Handle);

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

%-scatterpolar type-%
obj.data{plotIndex}.type = 'scatterpolar';

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

%-scatter visible-%
obj.data{plotIndex}.visible = strcmp(plot_data.Visible,'on');

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

%-scatter r-data-%
obj.data{plotIndex}.r = abs(plot_data.RData);

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

%-scatter theta-data-%
obj.data{plotIndex}.theta = rad2deg(plot_data.ThetaData);

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

%-scatterpolar name-%
obj.data{plotIndex}.name = plot_data.DisplayName;

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

%-scatterpolar mode-%
if ~strcmpi('none', plot_data.Marker) ...
&& ~strcmpi('none', plot_data.LineStyle)
mode = 'lines+markers';
elseif ~strcmpi('none', plot_data.Marker)
mode = 'markers';
elseif ~strcmpi('none', plot_data.LineStyle)
mode = 'lines';
else
mode = 'none';
end

obj.data{plotIndex}.mode = mode;

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

%-scatter line-%
obj.data{plotIndex}.line = extractLineLine(plot_data);
obj.data{plotIndex}.line.width = 2 * obj.data{plotIndex}.line.width;

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

%-scatter marker-%
obj.data{plotIndex}.marker = extractLineMarker(plot_data);

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

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

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

obj.data{plotIndex}.showlegend = showleg;

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

end
27 changes: 26 additions & 1 deletion plotly/plotlyfig_aux/handlegraphics/updateStem.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
%-update line-%
updateLineseries(obj,dataIndex);
stem_temp_data = obj.data{dataIndex};
isstem3d = obj.PlotOptions.is3d;

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

Expand All @@ -17,6 +18,10 @@
xdata_extended = zeros(1,3*length(stem_temp_data.x));
ydata_extended = zeros(1,3*length(stem_temp_data.y));

if isstem3d
zdata_extended = zeros(1,3*length(stem_temp_data.z));
end

%-format x data-%
m = 1;
for n = 1:length(stem_temp_data.x)
Expand All @@ -29,12 +34,28 @@
%-format y data-%
m = 1;
for n = 1:length(stem_temp_data.y)
ydata_extended(m) = 0;
ydata_extended(m) = 0;

if isstem3d
ydata_extended(m) = stem_temp_data.y(n);
end

ydata_extended(m+1) = stem_temp_data.y(n);
ydata_extended(m+2) = nan;
m = m + 3;
end

%-format z data-%
if isstem3d
m = 1;
for n = 1:length(stem_temp_data.z)
zdata_extended(m) = 0;
zdata_extended(m+1) = stem_temp_data.z(n);
zdata_extended(m+2) = nan;
m = m + 3;
end
end

%-hide every other marker-%
color_temp = cell(1,3*length(stem_temp_data.y));
line_color_temp = cell(1,3*length(stem_temp_data.y));
Expand All @@ -57,6 +78,10 @@
stem_temp_data.x = xdata_extended;
stem_temp_data.y = ydata_extended;

if isstem3d
stem_temp_data.z = zdata_extended;
end

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

obj.data{dataIndex} = stem_temp_data;
Expand Down