Skip to content

Commit c977e7d

Browse files
authored
Merge branch 'master' into issue225
2 parents cca6c01 + d8078c8 commit c977e7d

17 files changed

+935
-746
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dev/
2-
untitled.html
2+
*.asv
3+
untitled.html

plotly/plotly_offline_aux/plotlyoffline.m

+2-4
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@
6060
'\n });'], id, clean_jdata, clean_jlayout, ...
6161
id, link_text);
6262

63-
plotly_script = sprintf(['\n<div class="%s loading" style=', ...
64-
'color: rgb(50,50,50);">Drawing...</div>' ...
65-
'\n<div id="%s" style="height: %s;',...
63+
plotly_script = sprintf(['\n<div id="%s" style="height: %s;',...
6664
'width: %s;" class="plotly-graph-div">' ...
6765
'</div> \n<script type="text/javascript">' ...
68-
'%s \n</script>'], id, id, height, width, ...
66+
'%s \n</script>'], id, height, width, ...
6967
script);
7068

7169
% template entire script

plotly/plotlyfig.m

+56-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
obj.PlotOptions.OpenURL = true;
5959
obj.PlotOptions.Strip = false;
6060
obj.PlotOptions.Visible = 'on';
61-
obj.PlotOptions.TriangulatePatch = false;
61+
obj.PlotOptions.TriangulatePatch = false;
62+
obj.PlotOptions.StripMargins = false;
6263

6364
% offline options
6465
obj.PlotOptions.Offline = true;
@@ -192,6 +193,9 @@
192193
if(strcmpi(varargin{a},'data'))
193194
obj.data = varargin{a+1};
194195
end
196+
if(strcmpi(varargin{a},'StripMargins'))
197+
obj.PlotOptions.StripMargins = varargin{a+1};
198+
end
195199
end
196200
end
197201

@@ -237,8 +241,6 @@
237241

238242
% plotly reference
239243
plotlyref = load('plotly_reference.mat');
240-
% rmfield(plotlyref.pr, 'xbins');
241-
% plotlyref.pr.xbins.size
242244

243245
% update the PlotlyRef property
244246
obj.PlotlyReference = plotlyref.pr;
@@ -425,6 +427,14 @@ function validate(obj)
425427
obj.strip;
426428
end
427429

430+
% strip margins
431+
if obj.PlotOptions.StripMargins
432+
obj.layout.margin.l = 0;
433+
obj.layout.margin.r = 0;
434+
obj.layout.margin.b = 0;
435+
obj.layout.margin.t = 0;
436+
end
437+
428438
% validate keys
429439
validate(obj);
430440

@@ -436,7 +446,7 @@ function validate(obj)
436446
cleanFeedTitle(obj);
437447
end
438448

439-
%args
449+
%get args
440450
args.filename = obj.PlotOptions.FileName;
441451
args.fileopt = obj.PlotOptions.FileOpt;
442452
args.world_readable = obj.PlotOptions.WorldReadable;
@@ -480,7 +490,32 @@ function validate(obj)
480490
obj.State.Figure.NumTexts = 0;
481491

482492
% find axes of figure
483-
ax = findobj(obj.State.Figure.Handle,'Type','axes','-and',{'Tag','','-or','Tag','PlotMatrixBigAx','-or','Tag','PlotMatrixScatterAx'});
493+
ax = findobj(obj.State.Figure.Handle,'Type','axes','-and',{'Tag','','-or','Tag','PlotMatrixBigAx','-or','Tag','PlotMatrixScatterAx', '-or','Tag','PlotMatrixHistAx'});
494+
if isempty(ax)
495+
ax = gca;
496+
end
497+
498+
%---------- checking the overlaping of the graphs ----------%
499+
temp_ax = ax; deleted_idx = 0;
500+
for i = 1:length(ax)
501+
for j = i:length(ax)
502+
if ((mean(eq(ax(i).Position, ax(j).Position)) == 1) && (i~=j) && strcmp(ax(i).Children.Type, 'histogram'))
503+
temp_plots = findobj(temp_ax(i),'-not','Type','Text','-not','Type','axes','-depth',1);
504+
if isprop(temp_plots, 'FaceAlpha')
505+
update_opac(i) = true;
506+
else
507+
update_opac(i) = false;
508+
end
509+
temp_ax(i).YTick = temp_ax(j- deleted_idx).YTick;
510+
temp_ax(i).XTick = temp_ax(j- deleted_idx).XTick;
511+
temp_ax(j - deleted_idx) = [];
512+
deleted_idx = deleted_idx + 1;
513+
end
514+
end
515+
end
516+
ax = temp_ax;
517+
%---------- checking the overlaping of the graphs ----------%
518+
484519
obj.State.Figure.NumAxes = length(ax);
485520

486521
% update number of annotations (one title per axis)
@@ -586,17 +621,29 @@ function validate(obj)
586621

587622
% update axes
588623
for n = 1:obj.State.Figure.NumAxes
589-
updateAxis(obj,n);
624+
try
625+
updateAxis(obj,n);
626+
end
590627
end
591628

592629
% update plots
593630
for n = 1:obj.State.Figure.NumPlots
594631
updateData(obj,n);
632+
633+
try
634+
if (strcmp(obj.data{n}.type, 'bar') && update_opac(length(ax)-n))
635+
obj.data{1, n}.opacity = 0.9;
636+
obj.data{1, n}.marker.color = 'rgb(0,113.985,188.955)';
637+
end
638+
end
639+
595640
end
596641

597642
% update annotations
598643
for n = 1:obj.State.Figure.NumTexts
599-
updateAnnotation(obj,n);
644+
try
645+
updateAnnotation(obj,n);
646+
end
600647
end
601648

602649
% update legends
@@ -838,7 +885,7 @@ function delete(obj)
838885
fnmod = fn;
839886

840887
try
841-
for d = 1:length(fn);
888+
for d = 1:length(fn)
842889

843890
% clean up axis keys
844891
if any(strfind(fn{d},'xaxis')) || any(strfind(fn{d},'yaxis'))
@@ -898,6 +945,7 @@ function delete(obj)
898945
if ~( ...
899946
strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ...
900947
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
948+
|| strcmpi(fieldname,'scatterpolar') ...
901949
)
902950
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
903951
end

0 commit comments

Comments
 (0)