Skip to content

chore: Update geo trace fitbounds default to 'locations'#7895

Open
camdecoster wants to merge 18 commits into
v4.0from
cam/7855/update-geo-fitbounds-default
Open

chore: Update geo trace fitbounds default to 'locations'#7895
camdecoster wants to merge 18 commits into
v4.0from
cam/7855/update-geo-fitbounds-default

Conversation

@camdecoster

@camdecoster camdecoster commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

Updates the fitbounds default value to "locations" for geo traces. Also fixes (previously unknown) bug related to using zoom buttons with fitbounds active.

Closes #7885

Changes

  • Changes default
  • Update schema and types
  • Persists view attributes to layout
  • Added check for fitbounds incompatible projections (craig/satellite/albers-usa)
  • Updates tests per above changes

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

  • Be on master
  • Load Plotly devtools
  • Open the mock geo_orthographic
  • Note that the plot is centered on the US/Canada
  • Switch to this branch
  • Open the same mock
  • Note that the plot is now centered on Asia

Notes

  • fitbounds used to default to false. This changes the default to "locations".
  • Any plot that wants to maintain the current view calculation will need to pass false to fitbounds
  • This update matches the convention that most mapping libraries use
  • The bug (fixed in this PR) meant that zoom button clicks had no effect on the view when fitbounds was active

@camdecoster camdecoster self-assigned this Jul 15, 2026
@camdecoster
camdecoster marked this pull request as ready for review July 16, 2026 18:59

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test seems somewhat less useful now. Might be worth setting fitbounds: false on this one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why the new image renders a smaller plot? Not a dealbreaker, but the previous version seems better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does fitbounds choose a center when the geoJSON wraps all the way around the globe?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top plot doesn't look right, why is the orange line forced to wrap off the right edge?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem correct

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems incorrect

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here re: centerpoint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably another one worth editing the mock to set fitbounds: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here? This seems wrong

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also seems wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants