Title: [BUG]: Table string cells render as NaN when cells.format is set before initial render, but Plotly.restyle renders correctly · Issue #5617 · plotly/plotly.py · GitHub
Open Graph Title: [BUG]: Table string cells render as NaN when cells.format is set before initial render, but Plotly.restyle renders correctly · Issue #5617 · plotly/plotly.py
X Title: [BUG]: Table string cells render as NaN when cells.format is set before initial render, but Plotly.restyle renders correctly · Issue #5617 · plotly/plotly.py
Description: Description When initializing a Plotly go.Table with string cell values such as "rgb(239, 243, 255)" and setting cells.format=[1] before the first render, the string values are displayed as NaN. However, if the same base table is rendere...
Open Graph Description: Description When initializing a Plotly go.Table with string cell values such as "rgb(239, 243, 255)" and setting cells.format=[1] before the first render, the string values are displayed as NaN. Ho...
X Description: Description When initializing a Plotly go.Table with string cell values such as "rgb(239, 243, 255)" and setting cells.format=[1] before the first render, the string values are displayed ...
Opengraph URL: https://github.com/plotly/plotly.py/issues/5617
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: Table string cells render as NaN when cells.format is set before initial render, but Plotly.restyle renders correctly","articleBody":"### Description\n\nWhen initializing a Plotly `go.Table` with string cell values such as\n`\"rgb(239, 243, 255)\"` and setting `cells.format=[1]` before the first render, the\nstring values are displayed as `NaN`.\n\nHowever, if the same base table is rendered first and the same `cells.format` value\nis then applied dynamically through `Plotly.restyle`, the table displays the original\nstring values correctly.\n\nThe setting is accepted by `plotly.py` and stored on the trace object, so this looks\nlike an initial-render formatting/coercion discrepancy in table traces rather than an\ninvalid Python-side property assignment.\n\n### Screenshots/Video\n\n\u003cimg width=\"1200\" height=\"800\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/a6b5eb16-aea8-4d9e-828b-10550123f1b3\" />\n\u003cimg width=\"1200\" height=\"800\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/037b1dc9-a540-49cb-bb8c-3e434ec69bbf\" />\n\n### Steps to reproduce\n\n\n```python\nimport io\n\nimport plotly\nimport plotly.graph_objects as go\nimport plotly.io as pio\nfrom PIL import Image, ImageChops\nfrom playwright.sync_api import sync_playwright\n\n\nprint(f\"Plotly version: {plotly.__version__}\")\n\nfig = go.Figure(\n go.Table(\n header={\"values\": [\"Color\"]},\n cells={\"values\": [[\"rgb(239, 243, 255)\", \"rgb(8, 81, 156)\"]]},\n )\n)\n\n# Screenshot 1 / plot1.png: set cells.format in Python before the initial render.\nfig.data[0].cells.format = [1]\nassert fig.data[0].cells.format == (1,)\nprint(\"Python-side cells.format:\", fig.data[0].cells.format)\nhtml1 = pio.to_html(fig, full_html=True, include_plotlyjs=\"cdn\")\n\n# Screenshot 2 / plot2.png: render first, then apply the same value with JS.\nfig.data[0].cells.format = None\nhtml2 = pio.to_html(fig, full_html=True, include_plotlyjs=\"cdn\")\nhtml2 = html2.replace(\n \"\u003c/body>\",\n \"\"\"\n\u003cscript>\nwindow.addEventListener(\"DOMContentLoaded\", () => {\n const plotEl = document.getElementsByClassName(\"plotly-graph-div\")[0];\n setTimeout(() => {\n Plotly.restyle(plotEl, {\"cells.format\": [1]}, [0]);\n }, 1000);\n});\n\u003c/script>\n\u003c/body>\"\"\",\n)\n\nwith sync_playwright() as playwright:\n browser = playwright.chromium.launch(\n headless=True,\n args=[\"--no-sandbox\", \"--disable-dev-shm-usage\", \"--disable-gpu\"],\n )\n page = browser.new_page(viewport={\"width\": 1200, \"height\": 800})\n\n page.set_content(html1)\n page.wait_for_timeout(1500)\n img1 = page.screenshot(path=\"plot1.png\")\n\n page.set_content(html2)\n page.wait_for_timeout(2000)\n img2 = page.screenshot(path=\"plot2.png\")\n\n browser.close()\n\ndiff = ImageChops.difference(\n Image.open(io.BytesIO(img1)).convert(\"RGB\"),\n Image.open(io.BytesIO(img2)).convert(\"RGB\"),\n)\n\nprint(\"Saved plot1.png and plot2.png\")\nassert diff.getbbox() is not None, \"Reproducer did not reproduce: images are identical.\"\n```\n\n### Notes\n\n_Add info here that doesn't fit in the other sections._\n","author":{"url":"https://github.com/ym-xie","@type":"Person","name":"ym-xie"},"datePublished":"2026-06-07T15:11:51Z","url":"https://github.com/plotly/plotly.py/issues/5617"}
| 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:9bb6e1ca-3833-3df8-f217-2d6397e59009 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA52:785A9:2B7B304:37389B2:6B01AE4E |
| html-safe-nonce | 9f8a8ca30f6430585946548be5ccaaedb4edc811cb0d610ffc840075579150a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTUyOjc4NUE5OjJCN0IzMDQ6MzczODlCMjo2QjAxQUU0RSIsInZpc2l0b3JfaWQiOiIxNTk1ODE0NTg2ODkwNjk0MjIyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 36fe6710542ba9eebc4ccf9643ea5f3e4b70169a45b185950ed855fa24c811ce |
| hovercard-subject-tag | issue:4607753721 |
| 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.py/5617/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fdcae23dc5c2abf9041aeb73d20972d759333995c01906dc6b1888328a11621c/plotly/plotly.py/issues/5617 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fdcae23dc5c2abf9041aeb73d20972d759333995c01906dc6b1888328a11621c/plotly/plotly.py/issues/5617 |
| og:image:alt | Description When initializing a Plotly go.Table with string cell values such as "rgb(239, 243, 255)" and setting cells.format=[1] before the first render, the string values are displayed as NaN. Ho... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ym-xie |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 14579099 |
| octolytics-dimension-repository_nwo | plotly/plotly.py |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14579099 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.py |
| 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