chore: Update geo trace fitbounds default to 'locations'#7895
chore: Update geo trace fitbounds default to 'locations'#7895camdecoster wants to merge 21 commits into
Conversation
There was a problem hiding this comment.
This test seems somewhat less useful now. Might be worth setting fitbounds: false on this one.
There was a problem hiding this comment.
Nah, those dots are great. /s
There was a problem hiding this comment.
This test still functions perfectly fine (i.e. if something goes wrong with tick0 for geo plots it will fail), but it might be worth setting a lower zoom level to make it more human-obvious what's going on here. Not a blocker.
There was a problem hiding this comment.
I'm going to disable fitbounds for this one as well. It's not helping anyone (or the test) to be so zoomed out.
There was a problem hiding this comment.
Do you know why the new image renders a smaller plot? Not a dealbreaker, but the previous version seems better.
There was a problem hiding this comment.
Funkiness with projections. This is also running into an issue on my TODO list. For now, I'll disable fitbounds.
There was a problem hiding this comment.
How does fitbounds choose a center when the geoJSON wraps all the way around the globe?
There was a problem hiding this comment.
It creates one big bounding box around all of the geometry and finds the smallest gap that contains that box. We use d3-geo to figure that out now, but it used to be @turf/bbox, which didn't handle the antimeridian at all.
There was a problem hiding this comment.
The top plot doesn't look right, why is the orange line forced to wrap off the right edge?
There was a problem hiding this comment.
This is happening because the smallest gap that contains the points (not the line) is what's shown. Adding the lines to the fit check is something I'm looking into.
There was a problem hiding this comment.
Green dotted line is cut off the top. Maybe this is an existing limitation with fitbounds, if so, it's not the end of the world but let's open an issue.
There was a problem hiding this comment.
I think it's an existing issue and it's on my list to work on in a follow up.
There was a problem hiding this comment.
This is due to disallowing fitbounds with the Albers USA projection.
There was a problem hiding this comment.
It seems not ideal to show less of the southern latitudes when there's no more of the northern latitudes to be shown, would it be possible to add a constraint that the north edge of the map can't be lower than the top of the plot area in the initial render?
There was a problem hiding this comment.
It does look a bit odd, but I think it's correct. It's fitting lat/lon, and the lat fit results in the frame getting pulled down. I'll add it to my follow up list. For now I'll disable fitbounds.
There was a problem hiding this comment.
I've got a fix for this.
There was a problem hiding this comment.
Again not totally clear to me how this centerpoint was chosen.
I mean, there's no reason the center has to be the Europe-centric map we're used to, although that does have the advantage of splitting fewer countries in half.
There was a problem hiding this comment.
Same comment here re: centerpoint
There was a problem hiding this comment.
There is some funkiness with handling coords around the antimeridian with choropleths. I'm working on a fix, but I think that can wait until after the the v4 release. For now, I'll disable fitbounds for this mock.
There was a problem hiding this comment.
Probably another one worth editing the mock to set fitbounds: false
There was a problem hiding this comment.
I'll add that and push a fix that should make this look like the original.
There was a problem hiding this comment.
What happened here? This seems wrong
There was a problem hiding this comment.
It is! I'll add a fix.
There was a problem hiding this comment.
I disallowed a few projections because the fitbounds math can lead to undesirable results. In this case, the result looks okay, but now it's not using fitbounds due to the disallow list. For now, I think we should keep the disallow list and I can follow up with a more nuanced approach after v4.
Description
Updates the
fitboundsdefault value to"locations"for geo traces. Also fixes (previously unknown) bug related to using zoom buttons withfitboundsactive.Closes #7885
Changes
fitboundsincompatible projections (craig/satellite/albers-usa)Videos
Before (
fitbounds: false, default)Screencast.From.2026-07-09.15-30-04.mp4
Before (
fitbounds: "locations")Screencast.From.2026-07-09.16-51-23.mp4
After (
fitbounds: "locations", default)Screencast.From.2026-07-09.15-29-05.mp4
Testing
geo_orthographicNotes
fitboundsused to default tofalse. This changes the default to"locations".falsetofitboundsfitboundswas activeFollow up work
fitbounds: 'locations')fitBoundsPadding/maxZoomfor map subplotfitboundsIncompatibleprojections after baseline review