Skip to content

Commit 0b7d668

Browse files
improving scatterhistogram
1 parent 9d75c4c commit 0b7d668

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

plotly/plotlyfig.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,8 @@ function delete(obj)
10171017
|| strcmpi(fieldname,'scene') || strcmpi(fieldname,'layout') ...
10181018
|| strcmpi(fieldname,'heatmap') || strcmpi(fieldname,'xaxis') ...
10191019
|| strcmpi(fieldname,'yaxis') || strcmpi(fieldname,'cone')...
1020-
|| strcmpi(fieldname,'legend') ...
1020+
|| strcmpi(fieldname,'legend') || strcmpi(fieldname,'histogram')...
1021+
|| strcmpi(fieldname,'scatter')...
10211022
)
10221023
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
10231024
end

plotly/plotlyfig_aux/handlegraphics/updateScatterhistogram.m

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ function updateScatterhistogram(obj,scatterIndex)
113113
obj.data{p}.name = char(string(gs(t)));
114114
end
115115

116+
obj.data{p}.legendgroup = obj.data{p}.name;
116117
obj.data{p}.showlegend = true;
117118
end
118119

@@ -174,7 +175,6 @@ function updateScatterhistogram(obj,scatterIndex)
174175

175176
if ~ycateg
176177
yaxis.range = scatter_data.YLimits;
177-
% yaxis.nticks = 20;
178178
else
179179
yaxis.range = [min(yplot)-0.5, max(yplot)+0.5];
180180
yaxis.tickvals = 1:max(yplot);
@@ -275,9 +275,7 @@ function updateScatterhistogram(obj,scatterIndex)
275275
%-----------------------------------------------------------------------%
276276

277277
%-plot setting-%
278-
obj.data{p}.marker.color = 'rgba(0,0,0,0)';
279-
obj.data{p}.marker.line.color = sprintf('rgb(%f,%f,%f)', scatter_data.Color(t, :));
280-
obj.data{p}.marker.line.width = scatter_data.LineWidth(t);
278+
obj.data{p}.marker.color = sprintf('rgba(%f,%f,%f,0.7)', scatter_data.Color(t, :));
281279
obj.data{p}.histnorm = 'probability';
282280
obj.data{p}.histfunc = 'count';
283281

@@ -294,6 +292,8 @@ function updateScatterhistogram(obj,scatterIndex)
294292
catch
295293
obj.data{p}.name = char(string(gs(t)));
296294
end
295+
296+
obj.data{p}.legendgroup = obj.data{p}.name;
297297
end
298298

299299
%-----------------------------------------------------------------------%
@@ -355,9 +355,8 @@ function updateScatterhistogram(obj,scatterIndex)
355355
obj.layout = setfield(obj.layout, sprintf('xaxis%d', ps), xaxis1);
356356
obj.layout = setfield(obj.layout, sprintf('yaxis%d', ps), yaxis1);
357357

358-
obj.layout.plot_bgcolor = 'rgba(0,0,0,0)';
359-
obj.layout.paper_bgcolor = 'rgba(0,0,0,0)';
360358
obj.layout.barmode = 'overlay';
359+
obj.layout.bargap = 0.05;
361360

362361

363362
%=========================================================================%
@@ -390,9 +389,7 @@ function updateScatterhistogram(obj,scatterIndex)
390389
%-----------------------------------------------------------------------%
391390

392391
%-plot setting-%
393-
obj.data{p}.marker.color = 'rgba(0,0,0,0)';
394-
obj.data{p}.marker.line.color = sprintf('rgb(%f,%f,%f)', scatter_data.Color(t, :));
395-
obj.data{p}.marker.line.width = scatter_data.LineWidth(t);
392+
obj.data{p}.marker.color = sprintf('rgba(%f,%f,%f, 0.7)', scatter_data.Color(t, :));
396393
obj.data{p}.histnorm = 'probability';
397394
obj.data{p}.histfunc = 'count';
398395
obj.data{p}.orientation = 'h';
@@ -410,6 +407,8 @@ function updateScatterhistogram(obj,scatterIndex)
410407
catch
411408
obj.data{p}.name = char(string(gs(t)));
412409
end
410+
411+
obj.data{p}.legendgroup = obj.data{p}.name;
413412
end
414413

415414
%-----------------------------------------------------------------------%

0 commit comments

Comments
 (0)