Plotly.js: Can't set longitude range between [160, -160]

Created on 18 May 2017  路  3Comments  路  Source: plotly/plotly.js

Trying to center a scatter map around Fiji. I want the longitude to be between 140 and -140, like this image (I manually zoomed and panned to focus here)

image

Setting the longitude range to [140, -140] does not seem to work. I've also tried rolling over with [140, 220] to no avail. Here is a Codepen: https://codepen.io/chriddyp/pen/OmovzL?editors=1010. Here is a graph in the chart editor: https://plot.ly/create/?fid=chris:18383

馃帺 tip to @jackparmer who originally discovered this.

bug

Most helpful comment

@chriddyp I found a way to make this work without waiting for a patch:

All 3 comments

Looks like all custom lonaxis ranges that cross the antimeridian (where lon = -180 = 360) are broken.

This might be a good reason to start using d3 v4's d3-geo module which ships with a fitExtent method that probably does a better job than my ad hoc attempt.

@chriddyp I found a way to make this work without waiting for a patch:

cc @jackparmer in case you still need to make this example ^^

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HunterMcGushion picture HunterMcGushion  路  3Comments

nicolaskruchten picture nicolaskruchten  路  3Comments

hashimmoosavi picture hashimmoosavi  路  3Comments

danielsamuels picture danielsamuels  路  3Comments

tim-sauchuk picture tim-sauchuk  路  3Comments