@@ -30,7 +30,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
3030function handleGeoDefaults ( geoLayoutIn , geoLayoutOut , coerce , opts ) {
3131 var subplotData = getSubplotData ( opts . fullData , 'geo' , opts . id ) ;
3232 var traceIndices = subplotData . map ( function ( t ) { return t . _expandedIndex ; } ) ;
33- var show ;
3433
3534 var resolution = coerce ( 'resolution' ) ;
3635 var scope = coerce ( 'scope' ) ;
@@ -46,6 +45,9 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
4645 var isConic = geoLayoutOut . _isConic = projType . indexOf ( 'conic' ) !== - 1 ;
4746 var isClipped = geoLayoutOut . _isClipped = ! ! constants . lonaxisSpan [ projType ] ;
4847
48+ var visible = coerce ( 'visible' ) ;
49+ var show ;
50+
4951 for ( var i = 0 ; i < axesNames . length ; i ++ ) {
5052 var axisName = axesNames [ i ] ;
5153 var dtickDflt = [ 30 , 10 ] [ i ] ;
@@ -67,7 +69,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
6769 coerce ( axisName + '.tick0' ) ;
6870 coerce ( axisName + '.dtick' , dtickDflt ) ;
6971
70- show = coerce ( axisName + '.showgrid' ) ;
72+ show = coerce ( axisName + '.showgrid' , ! visible ? false : undefined ) ;
7173 if ( show ) {
7274 coerce ( axisName + '.gridcolor' ) ;
7375 coerce ( axisName + '.gridwidth' ) ;
@@ -106,13 +108,13 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
106108 coerce ( 'projection.rotation.lat' , dfltProjRotate [ 1 ] ) ;
107109 coerce ( 'projection.rotation.roll' , dfltProjRotate [ 2 ] ) ;
108110
109- show = coerce ( 'showcoastlines' , ! isScoped ) ;
111+ show = coerce ( 'showcoastlines' , ! isScoped && visible ) ;
110112 if ( show ) {
111113 coerce ( 'coastlinecolor' ) ;
112114 coerce ( 'coastlinewidth' ) ;
113115 }
114116
115- show = coerce ( 'showocean' ) ;
117+ show = coerce ( 'showocean' , ! visible ? false : undefined ) ;
116118 if ( show ) coerce ( 'oceancolor' ) ;
117119 }
118120
@@ -140,19 +142,19 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
140142
141143 coerce ( 'projection.scale' ) ;
142144
143- show = coerce ( 'showland' ) ;
145+ show = coerce ( 'showland' , ! visible ? false : undefined ) ;
144146 if ( show ) coerce ( 'landcolor' ) ;
145147
146- show = coerce ( 'showlakes' ) ;
148+ show = coerce ( 'showlakes' , ! visible ? false : undefined ) ;
147149 if ( show ) coerce ( 'lakecolor' ) ;
148150
149- show = coerce ( 'showrivers' ) ;
151+ show = coerce ( 'showrivers' , ! visible ? false : undefined ) ;
150152 if ( show ) {
151153 coerce ( 'rivercolor' ) ;
152154 coerce ( 'riverwidth' ) ;
153155 }
154156
155- show = coerce ( 'showcountries' , isScoped && scope !== 'usa' ) ;
157+ show = coerce ( 'showcountries' , isScoped && scope !== 'usa' && visible ) ;
156158 if ( show ) {
157159 coerce ( 'countrycolor' ) ;
158160 coerce ( 'countrywidth' ) ;
@@ -162,14 +164,15 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
162164 // Only works for:
163165 // USA states at 110m
164166 // USA states + Canada provinces at 50m
165- coerce ( 'showsubunits' , true ) ;
167+ // !!
168+ coerce ( 'showsubunits' , visible ) ;
166169 coerce ( 'subunitcolor' ) ;
167170 coerce ( 'subunitwidth' ) ;
168171 }
169172
170173 if ( ! isScoped ) {
171174 // Does not work in non-world scopes
172- show = coerce ( 'showframe' , true ) ;
175+ show = coerce ( 'showframe' , visible ) ;
173176 if ( show ) {
174177 coerce ( 'framecolor' ) ;
175178 coerce ( 'framewidth' ) ;
0 commit comments