Skip to content

Fix issues pie3 in ssim baselines matlab code examples data distribution plots pie3 #361

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
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
4 changes: 2 additions & 2 deletions plotly/plotlyfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,10 @@ function validate(obj)

% get number of nbars for pie3
if strcmpi(obj.PlotOptions.TreatAs, 'pie3')
obj.PlotOptions.nbars = 0;
obj.PlotOptions.nbars{a} = 0;
for i = 1:length(plots)
if strcmpi(getGraphClass(plots(i)), 'surface')
obj.PlotOptions.nbars = obj.PlotOptions.nbars + 1;
obj.PlotOptions.nbars{a} = obj.PlotOptions.nbars{a} + 1;
end
end
end
Expand Down
20 changes: 17 additions & 3 deletions plotly/plotlyfig_aux/core/updateAnnotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,29 @@
%-------------------------------------------------------------------------%

%-text-%
if ~strcmpi(obj.PlotOptions.TreatAs, 'pie3')
if obj.State.Text(anIndex).Title
obj.layout.annotations{anIndex}.text = parseString(text_data.String,text_data.Interpreter);
if obj.State.Text(anIndex).Title && isempty(text_data.String)
if isempty(text_data.String)
obj.layout.annotations{anIndex}.text = '<b></b>'; %empty string annotation
end
else
obj.layout.annotations{anIndex}.text = '<b></b>';
if ~strcmpi(obj.PlotOptions.TreatAs, 'pie3')
obj.layout.annotations{anIndex}.text = parseString(text_data.String,text_data.Interpreter);
else
obj.layout.annotations{anIndex}.text = '<b></b>';
end
end

%-optional code flow-%
% if ~strcmpi(obj.PlotOptions.TreatAs, 'pie3')
% obj.layout.annotations{anIndex}.text = parseString(text_data.String,text_data.Interpreter);
% if obj.State.Text(anIndex).Title && isempty(text_data.String)
% obj.layout.annotations{anIndex}.text = '<b></b>'; %empty string annotation
% end
% else
% obj.layout.annotations{anIndex}.text = '<b></b>';
% end

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

if obj.State.Text(anIndex).Title
Expand Down
3 changes: 3 additions & 0 deletions plotly/plotlyfig_aux/core/updateAxis.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@

%-xaxis domain-%
xaxis.domain = min([xo xo + w],1);
scene.domain.x = min([xo xo + w],1);

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

%-yaxis domain-%
yaxis.domain = min([yo yo + h],1);
scene.domain.y = min([yo yo + h],1);

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

Expand Down Expand Up @@ -135,6 +137,7 @@
% update the layout field (do not overwrite source)
if xsource == axIndex
obj.layout = setfield(obj.layout,['xaxis' num2str(xsource)],xaxis);
obj.layout = setfield(obj.layout,['scene' num2str(xsource)],scene);
else

end
Expand Down
2 changes: 2 additions & 0 deletions plotly/plotlyfig_aux/core/updateData.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
updateLineseries(obj, dataIndex);
elseif strcmpi(obj.PlotOptions.TreatAs, 'ezpolar')
updateLineseries(obj, dataIndex);
elseif strcmpi(obj.PlotOptions.TreatAs, 'streamtube')
updateStreamtube(obj, dataIndex);
end

%-update plot based on plot call class-%
Expand Down
180 changes: 55 additions & 125 deletions plotly/plotlyfig_aux/handlegraphics/updateContourProjection.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
axis_data = get(obj.State.Plot(contourIndex).AssociatedAxis);

%-PLOT DATA STRUCTURE- %
contour_data = get(obj.State.Plot(contourIndex).Handle)
contour_data = get(obj.State.Plot(contourIndex).Handle);

%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj,axIndex);
Expand Down Expand Up @@ -40,68 +40,29 @@
xdata = contour_data.XData;
ydata = contour_data.YData;
zdata = contour_data.ZData;

if isvector(zdata)

%-contour type-%
obj.data{contourIndex}.type = 'contour';

%-contour x data-%
if ~isvector(x)
obj.data{contourIndex}.xdata = xdata(1,:);
else
obj.data{contourIndex}.xdata = xdata;
end
%-contour type-%
obj.data{contourIndex}.type = 'surface';

%-contour y data-%
if ~isvector(y)
obj.data{contourIndex}.ydata = ydata';
else
obj.data{contourIndex}.ydata = ydata';
end

%-contour z data-%
obj.data{contourIndex}.z = zdata;

else

%-contour type-%
obj.data{contourIndex}.type = 'surface';

%-contour x and y data
% [xmesh, ymesh] = meshgrid(xdata, ydata);
obj.data{contourIndex}.x = xdata;
obj.data{contourIndex}.y = ydata;

%-contour z data-%
obj.data{contourIndex}.z = zdata;%-2*ones(size(zdata));

%-setting for contour lines z-direction-%
obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1);
obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end);
obj.data{contourIndex}.contours.z.size = contour_data.LevelStep;
obj.data{contourIndex}.contours.z.show = true;
obj.data{contourIndex}.contours.z.usecolormap = true;
obj.data{contourIndex}.hidesurface = true;
obj.data{contourIndex}.surfacecolor = zdata;

obj.data{contourIndex}.contours.z.project.x = true;
obj.data{contourIndex}.contours.z.project.y = true;
obj.data{contourIndex}.contours.z.project.z = true;

end
%-contour x and y data
obj.data{contourIndex}.x = xdata;
obj.data{contourIndex}.y = ydata;

%-------------------------------------------------------------------------%
%-contour z data-%
obj.data{contourIndex}.z = zdata;%-2*ones(size(zdata));

%-contour x type-%
%-setting for contour lines z-direction-%
obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1);
obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end);
obj.data{contourIndex}.contours.z.size = contour_data.LevelStep;
obj.data{contourIndex}.contours.z.show = true;
obj.data{contourIndex}.contours.z.usecolormap = true;
obj.data{contourIndex}.hidesurface = true;
obj.data{contourIndex}.surfacecolor = zdata;

obj.data{contourIndex}.xtype = 'array';

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

%-contour y type-%

obj.data{contourIndex}.ytype = 'array';
obj.data{contourIndex}.contours.z.project.x = true;
obj.data{contourIndex}.contours.z.project.y = true;
obj.data{contourIndex}.contours.z.project.z = true;

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

Expand All @@ -116,21 +77,6 @@

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

%-zauto-%
obj.data{contourIndex}.zauto = false;

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

%-zmin-%
obj.data{contourIndex}.zmin = axis_data.CLim(1);

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

%-zmax-%
obj.data{contourIndex}.zmax = axis_data.CLim(2);

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

%-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-%
colormap = figure_data.Colormap;

Expand All @@ -144,69 +90,53 @@
%-contour reverse scale-%
obj.data{contourIndex}.reversescale = false;

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

%-autocontour-%
obj.data{contourIndex}.autocontour = false;
%---------------------------------------------------------------------%

%-------------------------------------------------------------------------%
%-aspect ratio-%
ar = obj.PlotOptions.AspectRatio;

%-contour contours-%
if ~isempty(ar)
if ischar(ar)
obj.layout.scene.aspectmode = ar;
elseif isvector(ar) && length(ar) == 3
xar = ar(1);
yar = ar(2);
zar = ar(3);
end
else

%-coloring-%
switch contour_data.Fill
case 'off'
obj.data{contourIndex}.contours.coloring = 'lines';
case 'on'
obj.data{contourIndex}.contours.coloring = 'fill';
%-define as default-%
xar = max(xdata(:));
yar = max(ydata(:));
xyar = max([xar, yar]);
zar = 0.6*xyar;
end

%-start-%
obj.data{contourIndex}.contours.start = contour_data.TextList(1);
obj.layout.scene.aspectratio.x = xyar;
obj.layout.scene.aspectratio.y = xyar;
obj.layout.scene.aspectratio.z = zar;

%-end-%
obj.data{contourIndex}.contours.end = contour_data.TextList(end);
%---------------------------------------------------------------------%

%-step-%
obj.data{contourIndex}.contours.size = diff(contour_data.TextList(1:2));
%-camera eye-%
ey = obj.PlotOptions.CameraEye;

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

if(~strcmp(contour_data.LineStyle,'none'))

%-contour line colour-%
if isnumeric(contour_data.LineColor)
col = 255*contour_data.LineColor;
obj.data{contourIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
else
obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)';
end

%-contour line width-%
obj.data{contourIndex}.line.width = contour_data.LineWidth;

%-contour line dash-%
switch contour_data.LineStyle
case '-'
LineStyle = 'solid';
case '--'
LineStyle = 'dash';
case ':'
LineStyle = 'dot';
case '-.'
LineStyle = 'dashdot';
if ~isempty(ey)
if isvector(ey) && length(ey) == 3
obj.layout.scene.camera.eye.x = ey(1);
obj.layout.scene.camera.eye.y = ey(2);
obj.layout.scene.camera.eye.z = ey(3);
end

obj.data{contourIndex}.line.dash = LineStyle;

%-contour smoothing-%
obj.data{contourIndex}.line.smoothing = 0;

else

%-define as default-%
xey = - xyar; if xey>0 xfac = -0.2; else xfac = 0.2; end
yey = - xyar; if yey>0 yfac = -0.2; else yfac = 0.2; end
if zar>0 zfac = 0.2; else zfac = -0.2; end

%-contours showlines-%
obj.data{contourIndex}.contours.showlines = false;

obj.layout.scene.camera.eye.x = xey + xfac*xey;
obj.layout.scene.camera.eye.y = yey + yfac*yey;
obj.layout.scene.camera.eye.z = zar + zfac*zar;
end

%-------------------------------------------------------------------------%
Expand Down
Loading