Skip to content

fix issues with histogram function in ssim_baselines/matlab/code-examples/data-distribution-plots/histogram/ #365

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
10 changes: 5 additions & 5 deletions plotly/plotlyfig_aux/core/updateData.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
updateLineseries(obj, dataIndex);
elseif strcmpi(obj.PlotOptions.TreatAs, 'ezpolar')
updateLineseries(obj, dataIndex);
elseif strcmpi(obj.PlotOptions.TreatAs, 'polarhistogram')
updateHistogramPolar(obj, dataIndex);

% this one will be revomed
elseif strcmpi(obj.PlotOptions.TreatAs, 'streamtube')
updateStreamtube(obj, dataIndex);
end
Expand All @@ -43,11 +47,7 @@
case 'categoricalhistogram'
updateCategoricalHistogram(obj, dataIndex);
case 'histogram'
if strcmpi(obj.State.Axis(dataIndex).Handle.Type, 'polaraxes')
updateHistogramPolar(obj, dataIndex);
else
updateHistogram(obj, dataIndex);
end
updateHistogram(obj, dataIndex);
case 'histogram2'
updateHistogram2(obj, dataIndex);
case 'patch'
Expand Down
16 changes: 8 additions & 8 deletions plotly/plotlyfig_aux/handlegraphics/updateCategoricalHistogram.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@

%-hist data-%
obj.data{histIndex}.width = hist_data.BarWidth;
obj.data{histIndex}.y = hist_data.BinCounts;
obj.data{histIndex}.y = hist_data.Values;

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

%-hist categorical layout on x-axis-%
obj.layout.xaxis1.type = 'category';
obj.layout.xaxis1.autotick = false;

gap = 1 - hist_data.BarWidth;
xmin = -0.5 * gap;
xmax = (hist_data.NumDisplayBins - 1) + 0.5 * gap;
xmin = -gap;
xmax = (hist_data.NumDisplayBins - 1) + gap;

obj.layout.xaxis1.range = {xmin, xmax};
t = 'category';
eval(['obj.layout.xaxis' num2str(xsource) '.type = t;']);
eval(['obj.layout.xaxis' num2str(xsource) '.autotick = false;']);
eval(['obj.layout.xaxis' num2str(xsource) '.range = {xmin, xmax};']);

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

Expand All @@ -113,7 +113,7 @@

%-hist opacity-%
if ~ischar(hist_data.FaceAlpha)
obj.data{histIndex}.opacity = hist_data.FaceAlpha;
obj.data{histIndex}.opacity = 1.25*hist_data.FaceAlpha;
end

%-------------------------------------------------------------------------%
Expand Down
4 changes: 2 additions & 2 deletions plotly/plotlyfig_aux/handlegraphics/updateHistogram.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

obj.data{histIndex}.x = hist_data.BinEdges(1:end-1) + 0.5*diff(hist_data.BinEdges);
obj.data{histIndex}.width = diff(hist_data.BinEdges);%[hist_data.BinEdges(2:end), hist_data.Data(end)];
obj.data{histIndex}.y = double(hist_data.BinCounts);
obj.data{histIndex}.y = double(hist_data.Values);

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

Expand Down Expand Up @@ -186,7 +186,7 @@

%-hist opacity-%
if ~ischar(hist_data.FaceAlpha)
obj.data{histIndex}.opacity = hist_data.FaceAlpha;
obj.data{histIndex}.opacity = hist_data.FaceAlpha * 1.25;
end

%-------------------------------------------------------------------------%
Expand Down
7 changes: 1 addition & 6 deletions plotly/plotlyfig_aux/helpers/extractPatchFace.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,12 @@
capCD = max(min(patch_data.FaceVertexCData(1,1),axis_data.CLim(2)),axis_data.CLim(1));
scalefactor = (capCD -axis_data.CLim(1))/diff(axis_data.CLim);
col = 255*(colormap(1+ floor(scalefactor*(length(colormap)-1)),:));
case 'direct'
case {'direct', 'auto'}
col = 255*(colormap(patch_data.FaceVertexCData(1,1),:));

end

marker.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];

case 'auto'
marker.color = 'rgb(0,113.985,188.955)';

end
end

Expand All @@ -64,7 +60,6 @@

col = 255*patch_data.EdgeColor;
marker.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];

else
switch patch_data.EdgeColor

Expand Down