@@ -17,78 +17,96 @@ function UpdateGeoAxes(obj, geoIndex)
1717 w = geoData .Position(3 );
1818 h = geoData .Position(4 );
1919
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 );
2222
2323 % -------------------------------------------------------------------------%
2424
2525 % -setting projection-%
26- geo.projection.type = ' mercator' ;
26+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
27+ geoaxes.projection.type = ' mercator' ;
28+ end
2729
2830 % -------------------------------------------------------------------------%
2931
3032 % -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
4245
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
4650
4751 % -------------------------------------------------------------------------%
4852
4953 % -setting latitude axis-%
50- latTick = geoData .LatitudeAxis .TickValues ;
54+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
55+ latTick = geoData .LatitudeAxis .TickValues ;
5156
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 ));
5560
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
6066 end
6167
6268 % -------------------------------------------------------------------------%
6369
6470 % -setting longitude axis-%
65- lonTick = geoData .LongitudeAxis .TickValues ;
71+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
72+ lonTick = geoData .LongitudeAxis .TickValues ;
6673
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 ));
7077
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
7583 end
7684
7785 % -------------------------------------------------------------------------%
7886
7987 % -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 );
8290
8391 % -------------------------------------------------------------------------%
8492
8593 % -set better resolution-%
86- geo.resolution = ' 50' ;
94+ if strcmpi(obj .PlotOptions .geoRenderType , ' geo' )
95+ geoaxes.resolution = ' 50' ;
96+ end
8797
88- % -------------------------------------------------------------------------%
98+ % ----------------------------------------------------------------------------- %
8999
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
92110
93111 % -------------------------------------------------------------------------%
94112
@@ -120,16 +138,38 @@ function UpdateGeoAxes(obj, geoIndex)
120138 end
121139
122140 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+
124148 obj.data{geoIndex }.mode = ' text' ;
125149 obj.data{geoIndex }.text = texts ;
126150 obj.data{geoIndex }.lat = lats ;
127151 obj.data{geoIndex }.lon = lons ;
128- obj.data{geoIndex }.geo = obj.data{geoIndex - 1 }.geo;
129152
130153 obj.data{geoIndex }.textfont.size = sizes ;
131154 obj.data{geoIndex }.textfont.color = colors ;
132155 obj.data{geoIndex }.textfont.family = families ;
133156 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 );
134172 end
173+
174+ % -------------------------------------------------------------------------%
135175end
0 commit comments