Skip to content

Use the lowest error bar for the scatter3d log axis range - #8186

Open
Eliot5566 wants to merge 2 commits into
plotly:mainfrom
Eliot5566:fix-scatter3d-log-error-bound
Open

Eliot5566 wants to merge 2 commits into
plotly:mainfrom
Eliot5566:fix-scatter3d-log-error-bound

Conversation

@Eliot5566

Copy link
Copy Markdown

Fixes #8185.

On a log axis, calc_errors.js stored the lower error bound of the first point that had one and never lowered it:

if(!axis._lowerLogErrorBound) axis._lowerLogErrorBound = lower;
axis._lowerErrorBound = Math.min(axis._lowerLogErrorBound, lower); // never read

scene.js reads _lowerLogErrorBound for the autorange, so the range depended on the order of the points. The value also stayed on the axis between plots, so Plotly.react with new error bars kept the old bound.

Changes:

  • src/traces/scatter3d/calc_errors.js: keep the minimum in _lowerLogErrorBound and drop the unused _lowerErrorBound.
  • src/plots/gl3d/scene.js: clear _lowerLogErrorBound on the three axes before the scene updates its traces, so each plot computes it from the current data.

Tests:

  • Two new jasmine tests in scatter3d_test.js (log error bars): the z range is the same for both point orders, and Plotly.react gives the same range as Plotly.newPlot. Both fail on main.
  • I ran scatter3d_test.js (16 of 16 pass) and gl3dlayout_test.js (22 of 22 pass) in headless Chrome with SwiftShader. In gl3d_plot_interact, gl3d_hover_click and gl3d_annotations, 71 of 72 pass. The failing test, should allow text and tail position edits under editable: true, fails the same way on main in my environment.
  • npm run lint, npm run typecheck and npm run test-syntax pass.
  • Image baselines: I expect a change only for mocks with error_z (or x/y error bars) on a log axis where the lowest bar is not on the first point.

Before and after, rendered from local bundles with the example from the issue (rows sorted largest first). The z range starts at 10^1.01 before and at 10^0.52 after, so the lower bar of D (12 ± 8) is visible:

before and after

The draftlog is draftlogs/XXXX_fix.md; I will rename it to this PR's number in the next commit.

I used Claude to help write and test this change, and reviewed the diff before opening the PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hq1ACTsK85bRrY28fUQ7b3

Eliot5566 and others added 2 commits November 23, 2026 11:05
calc_errors kept the lower log error bound of the first point with an
error bar instead of the lowest one, so the autorange cut off error
bars when the smallest point was not first. The value also stayed on
the axis between plots, so Plotly.react kept a stale bound. Keep the
minimum and clear the bound before the scene updates its traces.

Fixes plotly#8185

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hq1ACTsK85bRrY28fUQ7b3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hq1ACTsK85bRrY28fUQ7b3
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.

[BUG]: scatter3d log z range cuts off error bars depending on the order of the points

1 participant