Title: [BUG]: contour with `xaxis.rangeslider` clips the main plot to the range slider's height (shared gap clipPath id) · Issue #8109 · plotly/plotly.js · GitHub
Open Graph Title: [BUG]: contour with `xaxis.rangeslider` clips the main plot to the range slider's height (shared gap clipPath id) · Issue #8109 · plotly/plotly.js
X Title: [BUG]: contour with `xaxis.rangeslider` clips the main plot to the range slider's height (shared gap clipPath id) · Issue #8109 · plotly/plotly.js
Description: Description When a contour trace is drawn with xaxis.rangeslider.visible: true, the main plot is clipped to a strip the height of the range slider. The rest of the subplot is blank. The range slider thumbnail itself renders correctly. Th...
Open Graph Description: Description When a contour trace is drawn with xaxis.rangeslider.visible: true, the main plot is clipped to a strip the height of the range slider. The rest of the subplot is blank. The range slide...
X Description: Description When a contour trace is drawn with xaxis.rangeslider.visible: true, the main plot is clipped to a strip the height of the range slider. The rest of the subplot is blank. The range slide...
Opengraph URL: https://github.com/plotly/plotly.js/issues/8109
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: contour with `xaxis.rangeslider` clips the main plot to the range slider's height (shared gap clipPath id)","articleBody":"### Description\n\nWhen a `contour` trace is drawn with `xaxis.rangeslider.visible: true`, the main plot is clipped to a strip the height of the range slider. The rest of the subplot is blank. The range slider thumbnail itself renders correctly.\n\nThis happens with the default `connectgaps: false`, **even when `z` has no missing values**. Heatmaps are not affected.\n\nReproduced in 4.1.1 (latest), 4.0.0, 3.7.0, 3.0.0, 2.35.3 and 1.58.5 (Chrome, headless and desktop).\n\n**Cause.** `clipGaps` in `src/traces/contour/plot.js` creates a single `\u003cclipPath>` per trace, keyed only by `trace.uid`, and computes its path with the axes of the subplot currently being drawn:\n\n```js\nfunction clipGaps(plotGroup, plotinfo, gd, cd0, perimeter) {\n var trace = cd0.trace;\n var clips = gd._fullLayout._clips;\n var clipId = 'clip' + trace.uid;\n // ... path computed with plotinfo.xaxis / plotinfo.yaxis\n Drawing.setClipUrl(plotGroup, clipId, gd);\n}\n```\n\nThe range slider draws the same trace again through `rangePlot` with its own small axes (`isRangePlot: true`). Both drawings share the same uid, so they share the same `clipPath`. The range plot is drawn last, so it overwrites the path with range-slider coordinates. The main plot then gets clipped by a shape that is only as tall as the slider.\n\nIn our measurements, the clip path bbox height equals the slider height (41px) instead of the plot area height (191px). Without the range slider, the clip path matches the plot area.\n\n### Screenshots/Video\n\nLeft: 4.1.1. Right: 4.1.1 with the one-line change below. Top row: full `z`. Bottom row: `z` with `null` cells.\n\n\u003cimg width=\"960\" height=\"840\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/bf471650-c8cc-4628-9d16-79ea6c01dcca\" />\n\n### Steps to reproduce\n\n\n```html\n\u003cscript src=\"https://cdn.plot.ly/plotly-4.1.1.js\">\u003c/script>\n\u003cdiv id=\"graph\" style=\"width:480px;height:420px\">\u003c/div>\n\u003cscript>\n var x = [0, 1, 2, 3, 4, 5];\n var y = [0, 1, 2, 3, 4];\n var z = y.map(function (j) { return x.map(function (i) { return 10 * (i + j); }); });\n\n Plotly.newPlot('graph', [{ type: 'contour', x: x, y: y, z: z }], {\n margin: { b: 90 },\n xaxis: { rangeslider: { visible: true } }\n });\n\u003c/script>\n```\n\n- Open the page.\n- Note that only a strip at the top of the main plot is drawn; the rest is blank.\n- The same happens after `Plotly.restyle` of `x`/`y`/`z`, after changing `xaxis.range` through the slider, and after `relayout` of a `coloraxis`.\n- With `z` containing `null`s (e.g. `[[10,20,30,40],[20,30,null,50],[30,null,50,60],[40,50,60,70]]`), the main plot is clipped the same way. The gaps only show up correctly in the range-slider thumbnail.\n\n### Notes\n\n**Workarounds and why they fall short**\n- `connectgaps: true` avoids the bug, because no clip path is created. But it changes the data: `null` cells get filled by interpolation, so the plot shows values that were never measured. That isn't acceptable when missing data must stay visible.\n- Disabling the range slider for contour traces is what we do for now.\n\n**Proposed fix (validated locally)**\n\nGive the range-plot drawing its own clip id:\n\n```diff\n function clipGaps(plotGroup, plotinfo, gd, cd0, perimeter) {\n var trace = cd0.trace;\n var clips = gd._fullLayout._clips;\n- var clipId = 'clip' + trace.uid;\n+ var clipId = 'clip' + trace.uid + (plotinfo.isRangePlot ? '-rangeplot' : '');\n```\n\nI applied the equivalent change to the 4.1.1 dist bundle and re-ran the cases above:\n- Full `z`, `z` with nulls, restyle of x/y/z, range change from the slider, `coloraxis` relayout, and a grid filled row by row (25% → 100%) all render correctly.\n- Gaps stay gaps in both the main plot and the thumbnail.\n- The main clip path matches the plot area height again.\n\nThe change above is a suggestion based on local testing; I haven't opened a PR. Feel free to use it if it fits.\n\n\nPossibly related: #705 (2016, contour + range slider, \"some `\u003cclipPath>` node is not getting updated properly\"). It was closed as a duplicate of #558 for lack of a repro.","author":{"url":"https://github.com/YkRic","@type":"Person","name":"YkRic"},"datePublished":"2026-10-05T14:27:40Z","url":"https://github.com/plotly/plotly.js/issues/8109"}
| 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:94e14007-47ff-eb7b-22e0-e2a394a0e628 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF22:3CBB3E:1EB6235:272B9EA:6B01AB85 |
| html-safe-nonce | 772666e3c569e0c224b31755db8fbe74fcf68bfa1b212a1b3007b4affa16ebac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjIyOjNDQkIzRToxRUI2MjM1OjI3MkI5RUE6NkIwMUFCODUiLCJ2aXNpdG9yX2lkIjoiOTEzODE1MDg1NTE4MTE4Mzg3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6392f8e42ad69b7f4fce96b47b9b6e6425574246f57c69d3f66274fa6b2b5961 |
| hovercard-subject-tag | issue:5713802297 |
| 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/8109/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e42a08cb5ecec3a3e41020a3b90dce73a78ac61a0135459bf498157eba54b2e7/plotly/plotly.js/issues/8109 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e42a08cb5ecec3a3e41020a3b90dce73a78ac61a0135459bf498157eba54b2e7/plotly/plotly.js/issues/8109 |
| og:image:alt | Description When a contour trace is drawn with xaxis.rangeslider.visible: true, the main plot is clipped to a strip the height of the range slider. The rest of the subplot is blank. The range slide... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | YkRic |
| 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