Repository navigation
Conversation
clean_2d_array lays z out on all the axis categories, so the bricks must start at 0. The one-value shortcut started them at the category index, which moved the column a second time. Fixes plotly#8175
|
Hi! Thanks for the pull request. To help us deal with the increased volume of contributions we’re receiving, can you answer two questions about this work?
We spend significant human effort reviewing each PR, so we really appreciate your help figuring out the best way to move this one toward merging. Thanks! |
Thanks for asking. 1/ It doesn’t affect my own work. I was looking for open bugs I could fix, and this one had a clear repro. 2/ I used Claude Code to find the cause, i wrote the fix myself |
Fixes #8175.
A heatmap trace with one
xvalue on a category axis now sits at its category.Cause
On a category axis,
clean_2d_array.jslays outzon all the axis categories. So the bricks of every trace must start at 0, as they do for a trace with two or morexvalues. For a trace with one value,make_bound_array.jsstarted the bricks at that value, the category index. The column then moved a second time, from index 2 to position 4 in the issue example. The same shortcut applies toy, and the same fix covers it.Change
make_bound_array.jsskips the one-value shortcut on a category axis. Other axis types keep the shortcut.Tests
The new case in
heatmap_test.jsplots the two traces from the issue. It expects the bricks of the second trace at[-0.5, 0.5, 1.5, 2.5]and the x axis range at[-0.5, 2.5]. Onmain, the case fails withExpected 1.5,2.5,3.5,4.5 to be close to -0.5,0.5,1.5,2.5andExpected -0.5,4.5 to be close to -0.5,2.5.Local runs on Windows 11 with Chrome 157:
heatmap_test.js: 51 of 51 passcontour_test.jsandhistogram2d_test.js: 48 of 48 passnpm run lintandnpm run typecheckpassnpm run test-syntaxfails on thewindow.getComputedStylecount on this machine, with and without the change. I did not run the image baseline tests.