Title: [BUG]: contour trace updated with Plotly.react uses stale zmin/zmax · Issue #8117 · plotly/plotly.js · GitHub
Open Graph Title: [BUG]: contour trace updated with Plotly.react uses stale zmin/zmax · Issue #8117 · plotly/plotly.js
X Title: [BUG]: contour trace updated with Plotly.react uses stale zmin/zmax · Issue #8117 · plotly/plotly.js
Description: Description When Plotly.react is called to update a plot that has a contour trace with autocontour true, the contour size/min/max are all calculated based on the previous contour trace z values. This can result in no contours being drawn...
Open Graph Description: Description When Plotly.react is called to update a plot that has a contour trace with autocontour true, the contour size/min/max are all calculated based on the previous contour trace z values. Th...
X Description: Description When Plotly.react is called to update a plot that has a contour trace with autocontour true, the contour size/min/max are all calculated based on the previous contour trace z values. Th...
Opengraph URL: https://github.com/plotly/plotly.js/issues/8117
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: contour trace updated with Plotly.react uses stale zmin/zmax","articleBody":"### Description\n\nWhen Plotly.react is called to update a plot that has a contour trace with autocontour true, the contour size/min/max are all calculated based on the previous contour trace z values. This can result in no contours being drawn or incorrect ones. This happens even though the data arrays are different instances.\n\nHow it happens:\nin plots/plots.js method supplyDefaults:\n```js\nif(oldFullData.length === newFullData.length) {\n for(i = 0; i \u003c newFullData.length; i++) {\n relinkPrivateKeys(newFullData[i], oldFullData[i]);\n }\n }\n```\ncopies the _zmin/_zmax from the previous trace to the new trace data\n\nin traces/contour/set_contours.js\nthe trace zmin/zmax are used to calculate the contour size/min/max\n\nIt is not until after setContours is called in \ntraces/contour/calc.js\nthat a call is made to \nColorscale.calc(gd, trace, {vals: cVals, cLetter: 'z'});\nthat the correct trace.zmin/zmax are filled in. \n\nSetting the trace.zmin/zmax to the correct values before the call to Plotly.react does not solve the problem. Right now the workaround is to set _zmin/_zmax to undefined before the call to react:\n```ts\nconst fullData = (this.plotDiv() as any)._fullData;\n\t\tif (fullData && fullData.length > 0) {\n\t\t\tfor (const trace of fullData) {\n\t\t\t\tif (trace.type === 'contour') {\n\t\t\t\t\ttrace.zmin = undefined;\n\t\t\t\t\ttrace.zmax = undefined;\n\t\t\t\t\ttrace._zmin = undefined;\n\t\t\t\t\ttrace._zmax = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n```\n\n### Steps to reproduce\nStackblitz \nhttps://stackblitz.com/edit/js-iffuoj?file=index.html\n\nFound in 2.35.1 but reproduced in 4.1.1\n\n","author":{"url":"https://github.com/greg9504","@type":"Person","name":"greg9504"},"datePublished":"2026-10-13T19:40:22Z","url":"https://github.com/plotly/plotly.js/issues/8117"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3da6ee42-7c35-67a9-a386-42fd37b72f31 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDF6:4D9F2:7612B3:9CA0C4:6B01AB92 |
| html-safe-nonce | 6f42c2570958818b6ec60822c26b53f4ee7fb58a7a84baee0272cdc973ae2d62 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREY2OjREOUYyOjc2MTJCMzo5Q0EwQzQ6NkIwMUFCOTIiLCJ2aXNpdG9yX2lkIjoiODE4NjgwMDMwNDczODY0MjgzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d62d2bcb14512dd5a07db8c3618618dec5f4a94d98fa355c92b054f4157b5914 |
| hovercard-subject-tag | issue:5836583999 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.js/8117/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0a932245599eec79d860db6f46c869d617aa278ef07b18d41c13c0705de2c9cf/plotly/plotly.js/issues/8117 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0a932245599eec79d860db6f46c869d617aa278ef07b18d41c13c0705de2c9cf/plotly/plotly.js/issues/8117 |
| og:image:alt | Description When Plotly.react is called to update a plot that has a contour trace with autocontour true, the contour size/min/max are all calculated based on the previous contour trace z values. Th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | greg9504 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width