diff --git a/plotly/plotlyfig.m b/plotly/plotlyfig.m index ef707bd9..2a429d79 100644 --- a/plotly/plotlyfig.m +++ b/plotly/plotlyfig.m @@ -265,7 +265,10 @@ % strip the style keys from data for d = 1:length(obj.data) - if strcmpi(obj.data{d}.type, 'scatter') + if ( ... + strcmpi(obj.data{d}.type, 'scatter') || ... + strcmpi(obj.data{d}.type, 'bar') ... + ) return end obj.data{d} = obj.stripkeys(obj.data{d}, obj.data{d}.type, 'style'); @@ -889,7 +892,10 @@ function delete(obj) catch exception if obj.UserData.Verbose % catch 3D output until integrated into graphref - if ~(strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') || strcmpi(fieldname,'mesh3d')) + if ~( ... + strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ... + || strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ... + ) fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']); end end diff --git a/plotly/plotlyfig_aux/handlegraphics/updateHistogram.m b/plotly/plotlyfig_aux/handlegraphics/updateHistogram.m index 87b96ff4..0c4fb170 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateHistogram.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateHistogram.m @@ -73,13 +73,8 @@ %-------------------------------------------------------------------------% -%-hist type-% -obj.data{histIndex}.type = 'histogram'; - -%-------------------------------------------------------------------------% - -%-HIST XAXIS-% -obj.data{histIndex}.histfunc= 'count'; +%-bar type-% +obj.data{histIndex}.type = 'bar'; %-------------------------------------------------------------------------% @@ -93,19 +88,13 @@ switch orientation case {'vertical', 'horizontal'} - % histogram() - - obj.data{histIndex}.x = sort(hist_data.Data.'); - obj.data{histIndex}.autobinx = false; - - obj.data{histIndex}.xbins.start = hist_data.BinEdges(1); - obj.data{histIndex}.xbins.end = hist_data.BinEdges(end); - obj.data{histIndex}.xbins.size = mean(hist_data.BinEdges(2:end)-hist_data.BinEdges(1:end-1)); %-------------------------------------------------------------------------% + %-hist y data-% - %-layout bargap-% - obj.layout.bargap = 0; + 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); %-------------------------------------------------------------------------%