Description
layout.geo.fitbounds defaults to 'locations' in v4 (it was false in v3). When a choropleth (or scattergeo with locations) plots several locations and at least one crosses ±180°, the auto-fit resolves to a longitude span wider than the globe, so the subplot renders the default world view instead of a fit.
Affected territories are the ones whose features cross ±180°: USA (Aleutians), RUS, FJI, NZL, ATA. USA plus neighboring countries is a very common figure. This only appears when a crossing feature is combined with non-crossing ones.
Steps to reproduce
- Be on v4.0
- Run the following snippet in Plotly devtools:
Plotly.newPlot(gd, [{
type: 'choropleth',
locations: ['CAN', 'USA', 'MEX'],
locationmode: 'ISO-3',
z: [3, 2, 1],
showscale: false
}], {
geo: { projection: { type: 'equirectangular' } },
width: 700, height: 450
});
- Note that the view shows the world and splits the USA up
Notes
computeBbox returns east unwrapped past 180° for a crossing feature (USA → 172.6 … 293.0), while non-crossing features stay in negative degrees (CAN → -141.0 … -52.6)
calcGeoJSON pushes both into one flat array and calls findExtremes, so min = -141, max = 293 → 434°
- The existing compaction helper in
src/plots/geo/geo.js is unreachable here: it is skipped for any choropleth and for any trace with locations, and it operates on point longitudes rather than interval endpoints
Description
layout.geo.fitboundsdefaults to'locations'in v4 (it wasfalsein v3). When achoropleth(orscattergeowithlocations) plots several locations and at least one crosses ±180°, the auto-fit resolves to a longitude span wider than the globe, so the subplot renders the default world view instead of a fit.Affected territories are the ones whose features cross ±180°:
USA(Aleutians),RUS,FJI,NZL,ATA.USAplus neighboring countries is a very common figure. This only appears when a crossing feature is combined with non-crossing ones.Steps to reproduce
Notes
computeBboxreturnseastunwrapped past 180° for a crossing feature (USA→172.6 … 293.0), while non-crossing features stay in negative degrees (CAN→-141.0 … -52.6)calcGeoJSONpushes both into one flat array and callsfindExtremes, somin = -141,max = 293→ 434°src/plots/geo/geo.jsis unreachable here: it is skipped for any choropleth and for any trace withlocations, and it operates on point longitudes rather than interval endpoints