|
58 | 58 | obj.PlotOptions.OpenURL = true; |
59 | 59 | obj.PlotOptions.Strip = false; |
60 | 60 | obj.PlotOptions.Visible = 'on'; |
61 | | - obj.PlotOptions.TriangulatePatch = false; |
| 61 | + obj.PlotOptions.TriangulatePatch = false; |
| 62 | + obj.PlotOptions.StripMargins = false; |
62 | 63 |
|
63 | 64 | % offline options |
64 | 65 | obj.PlotOptions.Offline = true; |
|
192 | 193 | if(strcmpi(varargin{a},'data')) |
193 | 194 | obj.data = varargin{a+1}; |
194 | 195 | end |
| 196 | + if(strcmpi(varargin{a},'StripMargins')) |
| 197 | + obj.PlotOptions.StripMargins = varargin{a+1}; |
| 198 | + end |
195 | 199 | end |
196 | 200 | end |
197 | 201 |
|
|
237 | 241 |
|
238 | 242 | % plotly reference |
239 | 243 | plotlyref = load('plotly_reference.mat'); |
240 | | - % rmfield(plotlyref.pr, 'xbins'); |
241 | | - % plotlyref.pr.xbins.size |
242 | 244 |
|
243 | 245 | % update the PlotlyRef property |
244 | 246 | obj.PlotlyReference = plotlyref.pr; |
@@ -425,6 +427,14 @@ function validate(obj) |
425 | 427 | obj.strip; |
426 | 428 | end |
427 | 429 |
|
| 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 | + |
428 | 438 | % validate keys |
429 | 439 | validate(obj); |
430 | 440 |
|
@@ -480,7 +490,32 @@ function validate(obj) |
480 | 490 | obj.State.Figure.NumTexts = 0; |
481 | 491 |
|
482 | 492 | % 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)) |
| 503 | + temp_plots = findobj(temp_ax(i),'-not','Type','Text','-not','Type','axes','-depth',1); |
| 504 | + if ~ischar(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 | + |
484 | 519 | obj.State.Figure.NumAxes = length(ax); |
485 | 520 |
|
486 | 521 | % update number of annotations (one title per axis) |
@@ -586,17 +621,29 @@ function validate(obj) |
586 | 621 |
|
587 | 622 | % update axes |
588 | 623 | for n = 1:obj.State.Figure.NumAxes |
589 | | - updateAxis(obj,n); |
| 624 | + try |
| 625 | + updateAxis(obj,n); |
| 626 | + end |
590 | 627 | end |
591 | 628 |
|
592 | 629 | % update plots |
593 | 630 | for n = 1:obj.State.Figure.NumPlots |
594 | 631 | 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 | + |
595 | 640 | end |
596 | 641 |
|
597 | 642 | % update annotations |
598 | 643 | for n = 1:obj.State.Figure.NumTexts |
599 | | - updateAnnotation(obj,n); |
| 644 | + try |
| 645 | + updateAnnotation(obj,n); |
| 646 | + end |
600 | 647 | end |
601 | 648 |
|
602 | 649 | % update legends |
@@ -838,7 +885,7 @@ function delete(obj) |
838 | 885 | fnmod = fn; |
839 | 886 |
|
840 | 887 | try |
841 | | - for d = 1:length(fn); |
| 888 | + for d = 1:length(fn) |
842 | 889 |
|
843 | 890 | % clean up axis keys |
844 | 891 | if any(strfind(fn{d},'xaxis')) || any(strfind(fn{d},'yaxis')) |
|
0 commit comments