1
1
function updateGeobubble(obj ,geoIndex )
2
2
3
- % -AXIS INDEX-%
4
- axIndex = obj .getAxisIndex(obj .State .Plot(geoIndex ).AssociatedAxis);
5
-
6
- % -GET STRUCTURES-%
7
- geoData = get(obj .State .Plot(geoIndex ).Handle);
3
+ % -----------------------------------------------------------------------------%
8
4
9
- % -CHECK FOR MULTIPLE AXES-%
10
- [xsource , ysource ] = findSourceAxis(obj ,axIndex );
5
+ % -INTIALIZATIONS-%
11
6
12
- % -----------------------------------------------------------------------------%
7
+ axIndex = obj .getAxisIndex(obj .State .Plot(geoIndex ).AssociatedAxis);
8
+ geoData = get(obj .State .Plot(geoIndex ).Handle);
9
+ [xSource , ~ ] = findSourceAxis(obj ,axIndex );
13
10
14
- % -PASE DATA -%
11
+ % -get trace data -%
15
12
bubbleRange = geoData .BubbleWidthRange ;
16
13
allLats = geoData .LatitudeData ;
17
14
allLons = geoData .LongitudeData ;
18
15
allSizes = rescale(geoData .SizeData , bubbleRange(1 ), bubbleRange(2 ));
16
+ colorMap = geoData .BubbleColorList ;
17
+ nColors = size(colorMap , 1 );
19
18
20
19
if ~isempty(geoData .ColorData )
21
20
allNames = geoData .ColorData ;
@@ -53,7 +52,7 @@ function updateGeobubble(obj,geoIndex)
53
52
54
53
% =============================================================================%
55
54
%
56
- % -SETTING GEOBBUBLE PLOT -%
55
+ % -SET TRACES -%
57
56
%
58
57
% =============================================================================%
59
58
@@ -71,50 +70,36 @@ function updateGeobubble(obj,geoIndex)
71
70
72
71
% -------------------------------------------------------------------------%
73
72
74
- % -set scattergeo type -%
73
+ % -set current trace -%
75
74
if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
76
75
obj.data{p }.type = ' scattergeo' ;
76
+ obj.data{p }.geo = sprintf(' geo%d ' , xSource + 1 );
77
77
78
- % -set scattermapbox type-%
79
78
elseif strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
80
79
obj.data{p }.type = ' scattermapbox' ;
80
+ obj.data{p }.subplot = sprintf(' mapbox%d ' , xSource + 1 );
81
81
end
82
82
83
- % -------------------------------------------------------------------------%
84
-
85
- % -set scattergeo mode-%
86
83
obj.data{p }.mode = ' markers' ;
87
84
88
85
% -------------------------------------------------------------------------%
89
86
90
- % -set plot data-%
87
+ % -set current trace data-%
91
88
obj.data{p }.lat = lat{g };
92
89
obj.data{p }.lon = lon{g };
93
90
94
91
% -------------------------------------------------------------------------%
95
92
96
- % -get marker setting -%
93
+ % -set trace marker -%
97
94
marker = struct();
98
95
marker.size = sData{g }*1.25 ;
99
- marker.color = sprintf( ' rgb( %f , %f , %f ) ' , 255 * geoData .BubbleColorList( g , : ));
96
+ marker.color = getStringColor( 255 * colorMap(mod( g - 1 , nColors )+ 1 , : ));
100
97
marker.line.color = ' rgb(255, 255, 255)' ;
101
98
102
- % -------------------------------------------------------------------------%
103
-
104
- % -set marker field-%
105
99
obj.data{p }.marker = marker ;
106
100
107
101
% -------------------------------------------------------------------------%
108
102
109
- % -ASSOCIATE GEO-AXES LAYOUT-%
110
- if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
111
- obj.data{p }.geo = sprintf(' geo%d ' , xsource + 1 );
112
- elseif strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
113
- obj.data{p }.subplot = sprintf(' mapbox%d ' , xsource + 1 );
114
- end
115
-
116
- % -------------------------------------------------------------------------%
117
-
118
103
% -legend-%
119
104
if byGroups
120
105
obj.data{p }.name = group{g };
@@ -128,7 +113,7 @@ function updateGeobubble(obj,geoIndex)
128
113
129
114
% =============================================================================%
130
115
%
131
- % -SETTING LAYOUT -%
116
+ % -UPDATE GEO AXES -%
132
117
%
133
118
% =============================================================================%
134
119
@@ -225,9 +210,9 @@ function updateGeobubble(obj,geoIndex)
225
210
226
211
% -set geo geoaxes to layout-%
227
212
if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
228
- obj.layout = setfield(obj .layout , sprintf(' geo%d ' , xsource + 1 ), geoaxes );
213
+ obj.layout = setfield(obj .layout , sprintf(' geo%d ' , xSource + 1 ), geoaxes );
229
214
elseif strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
230
- obj.layout = setfield(obj .layout , sprintf(' mapbox%d ' , xsource + 1 ), geoaxes );
215
+ obj.layout = setfield(obj .layout , sprintf(' mapbox%d ' , xSource + 1 ), geoaxes );
231
216
end
232
217
233
218
% -----------------------------------------------------------------------------%
0 commit comments