@@ -17,78 +17,96 @@ function UpdateGeoAxes(obj, geoIndex)
17
17
w = geoData .Position(3 );
18
18
h = geoData .Position(4 );
19
19
20
- geo .domain.x = min([xo xo + w ],1 );
21
- geo .domain.y = min([yo yo + h ],1 );
20
+ geoaxes .domain.x = min([xo xo + w ],1 );
21
+ geoaxes .domain.y = min([yo yo + h ],1 );
22
22
23
23
% -------------------------------------------------------------------------%
24
24
25
25
% -setting projection-%
26
- geo.projection.type = ' mercator' ;
26
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
27
+ geoaxes.projection.type = ' mercator' ;
28
+ end
27
29
28
30
% -------------------------------------------------------------------------%
29
31
30
32
% -setting basemap-%
31
- geo.framecolor = ' rgb(120,120,120)' ;
32
-
33
- if strcmpi(geoData .Basemap , ' streets-light' )
34
- geo.oceancolor = ' rgba(20,220,220,1)' ;
35
- geo.landcolor = ' rgba(20,220,220,0.2)' ;
36
- elseif strcmpi(geoData .Basemap , ' colorterrain' )
37
- geo.oceancolor = ' rgba(118,165,225,0.6)' ;
38
- geo.landcolor = ' rgba(190,180,170,1)' ;
39
- geo.showcountries = true ;
40
- geo.showlakes = true ;
41
- end
33
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
34
+ geoaxes.framecolor = ' rgb(120,120,120)' ;
35
+
36
+ if strcmpi(geoData .Basemap , ' streets-light' )
37
+ geoaxes.oceancolor = ' rgba(20,220,220,1)' ;
38
+ geoaxes.landcolor = ' rgba(20,220,220,0.2)' ;
39
+ elseif strcmpi(geoData .Basemap , ' colorterrain' )
40
+ geoaxes.oceancolor = ' rgba(118,165,225,0.6)' ;
41
+ geoaxes.landcolor = ' rgba(190,180,170,1)' ;
42
+ geoaxes.showcountries = true ;
43
+ geoaxes.showlakes = true ;
44
+ end
42
45
43
- geo.showocean = true ;
44
- geo.showcoastlines = false ;
45
- geo.showland = true ;
46
+ geoaxes.showocean = true ;
47
+ geoaxes.showcoastlines = false ;
48
+ geoaxes.showland = true ;
49
+ end
46
50
47
51
% -------------------------------------------------------------------------%
48
52
49
53
% -setting latitude axis-%
50
- latTick = geoData .LatitudeAxis .TickValues ;
54
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
55
+ latTick = geoData .LatitudeAxis .TickValues ;
51
56
52
- geo .lataxis.range = geoData .LatitudeLimits ;
53
- geo .lataxis.tick0 = latTick(1 );
54
- geo .lataxis.dtick = mean(diff(latTick ));
57
+ geoaxes .lataxis.range = geoData .LatitudeLimits ;
58
+ geoaxes .lataxis.tick0 = latTick(1 );
59
+ geoaxes .lataxis.dtick = mean(diff(latTick ));
55
60
56
- if strcmpi(geoData .Grid , ' on' )
57
- geo.lataxis.showgrid = true ;
58
- geo.lataxis.gridwidth = geoData .LineWidth ;
59
- geo.lataxis.gridcolor = sprintf(' rgba(%f ,%f ,%f ,%f )' , 255 * geoData .GridColor , geoData .GridAlpha );
61
+ if strcmpi(geoData .Grid , ' on' )
62
+ geoaxes.lataxis.showgrid = true ;
63
+ geoaxes.lataxis.gridwidth = geoData .LineWidth ;
64
+ geoaxes.lataxis.gridcolor = sprintf(' rgba(%f ,%f ,%f ,%f )' , 255 * geoData .GridColor , geoData .GridAlpha );
65
+ end
60
66
end
61
67
62
68
% -------------------------------------------------------------------------%
63
69
64
70
% -setting longitude axis-%
65
- lonTick = geoData .LongitudeAxis .TickValues ;
71
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
72
+ lonTick = geoData .LongitudeAxis .TickValues ;
66
73
67
- geo .lonaxis.range = geoData .LongitudeLimits ;
68
- geo .lonaxis.tick0 = lonTick(1 );
69
- geo .lonaxis.dtick = mean(diff(lonTick ));
74
+ geoaxes .lonaxis.range = geoData .LongitudeLimits ;
75
+ geoaxes .lonaxis.tick0 = lonTick(1 );
76
+ geoaxes .lonaxis.dtick = mean(diff(lonTick ));
70
77
71
- if strcmpi(geoData .Grid , ' on' )
72
- geo.lonaxis.showgrid = true ;
73
- geo.lonaxis.gridwidth = geoData .LineWidth ;
74
- geo.lonaxis.gridcolor = sprintf(' rgba(%f ,%f ,%f ,%f )' , 255 * geoData .GridColor , geoData .GridAlpha );
78
+ if strcmpi(geoData .Grid , ' on' )
79
+ geoaxes.lonaxis.showgrid = true ;
80
+ geoaxes.lonaxis.gridwidth = geoData .LineWidth ;
81
+ geoaxes.lonaxis.gridcolor = sprintf(' rgba(%f ,%f ,%f ,%f )' , 255 * geoData .GridColor , geoData .GridAlpha );
82
+ end
75
83
end
76
84
77
85
% -------------------------------------------------------------------------%
78
86
79
87
% -set map center-%
80
- geo .center.lat = geoData .MapCenter(1 );
81
- geo .center.lon = geoData .MapCenter(2 );
88
+ geoaxes .center.lat = geoData .MapCenter(1 );
89
+ geoaxes .center.lon = geoData .MapCenter(2 );
82
90
83
91
% -------------------------------------------------------------------------%
84
92
85
93
% -set better resolution-%
86
- geo.resolution = ' 50' ;
94
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
95
+ geoaxes.resolution = ' 50' ;
96
+ end
87
97
88
- % -------------------------------------------------------------------------%
98
+ % ----------------------------------------------------------------------------- %
89
99
90
- % -set geo axes to layout-%
91
- obj.layout = setfield(obj .layout , sprintf(' geo%d ' , xsource + 1 ), geo );
100
+ % -set mapbox style-%
101
+ if strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
102
+ geoaxes.zoom = geoData .ZoomLevel - 1.4 ;
103
+
104
+ if strcmpi(geoData .Basemap , ' streets-light' )
105
+ geoaxes.style = ' carto-positron' ;
106
+ elseif strcmpi(geoData .Basemap , ' colorterrain' )
107
+ geoaxes.style = ' stamen-terrain' ;
108
+ end
109
+ end
92
110
93
111
% -------------------------------------------------------------------------%
94
112
@@ -120,16 +138,38 @@ function UpdateGeoAxes(obj, geoIndex)
120
138
end
121
139
122
140
if isText
123
- obj.data{geoIndex }.type = ' scattergeo' ;
141
+
142
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
143
+ obj.data{geoIndex }.type = ' scattergeo' ;
144
+ elseif strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
145
+ obj.data{geoIndex }.type = ' scattermapbox' ;
146
+ end
147
+
124
148
obj.data{geoIndex }.mode = ' text' ;
125
149
obj.data{geoIndex }.text = texts ;
126
150
obj.data{geoIndex }.lat = lats ;
127
151
obj.data{geoIndex }.lon = lons ;
128
- obj.data{geoIndex }.geo = obj.data{geoIndex - 1 }.geo;
129
152
130
153
obj.data{geoIndex }.textfont.size = sizes ;
131
154
obj.data{geoIndex }.textfont.color = colors ;
132
155
obj.data{geoIndex }.textfont.family = families ;
133
156
obj.data{geoIndex }.textposition = pos ;
157
+
158
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
159
+ obj.data{geoIndex }.geo = obj.data{geoIndex - 1 }.geo;
160
+ elseif strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
161
+ obj.data{geoIndex }.subplot = obj.data{geoIndex - 1 }.subplot;
162
+ end
163
+ end
164
+
165
+ % -------------------------------------------------------------------------%
166
+
167
+ % -set geo axes to layout-%
168
+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
169
+ obj.layout = setfield(obj .layout , sprintf(' geo%d ' , xsource + 1 ), geoaxes );
170
+ elseif strcmpi(obj .PlotOptions .geoRenderType , ' mapbox' )
171
+ obj.layout = setfield(obj .layout , sprintf(' mapbox%d ' , xsource + 1 ), geoaxes );
134
172
end
173
+
174
+ % -------------------------------------------------------------------------%
135
175
end
0 commit comments