@@ -10,33 +10,30 @@ function updateBubblecloud(obj,bcIndex)
10
10
[xsource , ysource ] = findSourceAxis(obj ,axIndex );
11
11
12
12
% %-AXIS DATA-%
13
- % eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']);
14
- % eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']);
13
+ eval([' xaxis = obj.layout.xaxis' num2str(xsource ) ' ;' ]);
14
+ eval([' yaxis = obj.layout.yaxis' num2str(ysource ) ' ;' ]);
15
15
16
- % obj.layout.xaxis.side = 'bottom';
17
- obj.layout.xaxis1.showline = false ;
16
+ obj.layout.xaxis1.showline = true ;
18
17
obj.layout.xaxis1.zeroline = false ;
19
- % obj.layout.xaxis.autorange = false;
20
- % % obj.layout.xaxis.linecolor='rgb(0,0,0)';
21
- % obj.layout.xaxis.showgrid = true;
22
- % obj.layout.xaxis.linewidth = 1;
23
- % obj.layout.xaxis.type = 'linear';
24
- % obj.layout.xaxis.anchor = 'y1';
18
+ obj.layout.xaxis1.autorange = false ;
25
19
obj.layout.xaxis1.mirror = true ;
26
- %
27
- %
28
- % obj.layout.yaxis.side = 'left';
29
- obj.layout.yaxis1.showline = false ;
20
+
21
+ obj.layout.yaxis1.showline = true ;
30
22
obj.layout.yaxis1.zeroline = false ;
31
- % obj.layout.yaxis.autorange = false;
32
- % % obj.layout.yaxis.linecolor='rgb(0,0,0)';
33
- % obj.layout.yaxis.showgrid = true;
34
- % obj.layout.yaxis.linewidth = 1;
35
- % obj.layout.yaxis.type = 'linear';
36
- % obj.layout.yaxis.anchor = 'x1';
23
+ obj.layout.yaxis1.autorange = false ;
37
24
obj.layout.yaxis1.mirror = true ;
38
25
39
- obj.layout.title.text= ' <b><b></b></b>' ;
26
+ % %%%%%%%%%%%%%%
27
+ % Useful for debugging!!!
28
+ obj.layout.xaxis1.tickmode= ' auto' ;
29
+ obj.layout.xaxis1.nticks= 11 ;
30
+ obj.layout.xaxis1.showticklabels= 0 ;
31
+ obj.layout.yaxis1.tickmode= ' auto' ;
32
+ obj.layout.yaxis1.nticks= 11 ;
33
+ obj.layout.yaxis1.showticklabels= 0 ;
34
+ % %%%%%%%%%%%%%%
35
+
36
+ % obj.layout.title.text='<b><b></b></b>';
40
37
obj.layout.margin.t= 80 ;
41
38
obj.layout.annotations{1 }.text= ' ' ;
42
39
@@ -72,39 +69,49 @@ function updateBubblecloud(obj,bcIndex)
72
69
73
70
% -------------------------------------------------------------------------%
74
71
75
- [sortedradii ,sortind ]=sort(sqrt(real(bcData .SizeData )),' descend' );
76
- validind= isfinite(sortedradii ) & sortedradii > 0;
77
- sortind= sortind(validind );
78
- sortedradii= sortedradii(validind );
72
+ [sortedradii ,RadiusIndex ]=sort(sqrt(bcData .SizeData ),' descend' );
79
73
80
- if bcData .MaxDisplayBubbles < numel(sortind )
81
- sortind= sortind(1 : bcData .MaxDisplayBubbles );
82
- sortedradii= sortedradii(1 : bcData .MaxDisplayBubbles );
83
- end
84
- RadiusIndex= sortind ;
74
+ sortedradii= sortedradii / max(sortedradii );
85
75
86
- % Normalize radii so that the largest bubble has a radius of 1
87
- if ~isempty(sortedradii )
88
- sortedradii= sortedradii / max(sortedradii );
89
- end
76
+ ar = obj .layout .width / obj .layout .height ;
77
+
78
+ xIN = xaxis .domain(2 ) - xaxis .domain(1 );
79
+ yIN = yaxis .domain(2 ) - yaxis .domain(1 );
80
+ axAR = ar * xIN / yIN ;
90
81
91
- ar = 840 / 630 ;
92
82
xy = matlab .graphics .internal .layoutBubbleCloud(sortedradii ,ar );
93
- fac= 2 * ar ;
94
- rads = 2 * sortedradii * (840 / ( fac * max(xy(1 ,: )) - fac * min(xy(1 ,: ))));
95
- % xy = matlab.graphics.internal.layoutBubbleCloud(rads,ar);
96
83
97
- obj.layout.xaxis1.range= [fac * min(xy(1 ,: )), fac * max(xy(1 ,: ))];
98
- obj.layout.yaxis1.range= [(fac / ar )*min(xy(2 ,: )), (fac / ar )*max(xy(2 ,: ))];
84
+ xR = [min(xy(1 ,: )-sortedradii ), max(xy(1 ,: )+sortedradii )];
85
+ yR = [min(xy(2 ,: )-sortedradii ), max(xy(2 ,: )+sortedradii )];
86
+
87
+ xR = xR + [-0.025 , 0.025 ]*abs(diff(xR ));
88
+ yR = yR + [-0.025 , 0.025 ]*abs(diff(yR ));
89
+
90
+ dataAR = abs(diff(xR ))/abs(diff(yR ));
91
+
92
+ if dataAR > axAR
93
+ amounttopad = abs(diff(yR )) * dataAR / axAR - abs(diff(yR ));
94
+ yR = yR + [-amounttopad / 2 , amounttopad / 2 ];
95
+ else
96
+ amounttopad = abs(diff(xR )) * axAR / dataAR - abs(diff(xR ));
97
+ xR = xR + [-amounttopad / 2 , amounttopad / 2 ];
98
+ end
99
+
100
+ radX = (2 * sortedradii * (xIN * 840 ) / abs(diff(xR )));
101
+ % yR = [(yR(1)+yR(2))/2 - abs(diff(xR))/2, (yR(1)+yR(2))/2 + abs(diff(xR))/2];
102
+
103
+ % radY = (2*sortedradii * (yIN*630) / abs(diff(yR)));
99
104
100
- % rads = 2*rads * (840 / ( fac*max(xy(1,:)) - fac*min(xy(1,:))));
105
+ obj.layout.xaxis1.range= xR ;
106
+ obj.layout.yaxis1.range= yR + [0.32 ,-0.32 ];
107
+ rads= radX ;
101
108
102
109
% -------------------------------------------------------------------------%
103
110
104
111
labels = bcData .LabelData(RadiusIndex );
105
112
obj.data{bcIndex }.text = arrayfun(@(x ) {char(x )}, labels );
106
113
107
- obj.data{bcIndex }.textfont = matlab2plotlyfont(bcData .FontName );
114
+ % obj.data{bcIndex}.textfont = matlab2plotlyfont(bcData.FontName);
108
115
109
116
% -------------------------------------------------------------------------%
110
117
0 commit comments