{"record":{"id":"9a93396b82044e05","repo":"plotly/plotly.js","slug":"unrecognized-subplot-spid","errorCode":null,"errorMessage":"Unrecognized subplot: ${spId}","messagePattern":"Unrecognized subplot: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/fx/hover.js","lineNumber":342,"sourceCode":"    var xaArray = new Array(len);\n    var yaArray = new Array(len);\n    var supportsCompare = false;\n\n    for (var i = 0; i < len; i++) {\n        spId = subplots[i];\n\n        if (plots[spId]) {\n            // 'cartesian' case\n            supportsCompare = true;\n            xaArray[i] = plots[spId].xaxis;\n            yaArray[i] = plots[spId].yaxis;\n        } else if (fullLayout[spId] && fullLayout[spId]._subplot) {\n            // other subplot types\n            var _subplot = fullLayout[spId]._subplot;\n            xaArray[i] = _subplot.xaxis;\n            yaArray[i] = _subplot.yaxis;\n        } else {\n            Lib.warn('Unrecognized subplot: ' + spId);\n            return;\n        }\n    }\n\n    if (hovermode && !supportsCompare) hovermode = 'closest';\n\n    if (\n        ['x', 'y', 'closest', 'x unified', 'y unified'].indexOf(hovermode) === -1 ||\n        !gd.calcdata ||\n        gd.querySelector('.zoombox') ||\n        gd._dragging\n    ) {\n        return dragElement.unhoverRaw(gd, evt);\n    }\n\n    var hoverdistance = fullLayout.hoverdistance;\n    if (hoverdistance === -1) hoverdistance = Infinity;\n","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/plotly/plotly.js/blob/1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314/src/components/fx/hover.js#L324-L360","documentation":"Fx.hover resolves each requested subplot id (e.g. 'xy', 'x2y2', 'polar', 'geo') against fullLayout to find the axes to hover on. If the id is neither the default xy pair nor a known subplot with a _subplot object, it warns 'Unrecognized subplot: <id>' and aborts the hover.","triggerScenarios":"Calling Plotly.Fx.hover(gd, evt, 'x3y3') or another subplot id that does not exist in the graph's fullLayout — e.g. referencing x2y2 when the figure has only one x axis, or hovering a removed subplot after relayout deleted it.","commonSituations":"Hard-coded subplot ids that break when the figure changes shape; hover code written for a template figure reused on a smaller one; typo'd ids like 'xy2' vs 'x2y'; calling hover before the first plot completes.","solutions":["Verify the id exists: Plotly.d3.keys(gd._fullLayout) or check gd._fullLayout[spId] before calling Fx.hover.","Derive subplot ids dynamically from the figure (gd._fullLayout._subplots) instead of hard-coding.","Use the correct id format: cartesian subplots are 'xNYN' pairs like 'x2y2'; polar/geo/ternary use their own ids.","Guard the hover call behind a check that the subplot still exists after any relayout/deletion.","Ensure Plotly.newPlot has resolved (await it) before hover so fullLayout is populated."],"exampleFix":"// before\nPlotly.Fx.hover(gd, evt, 'x3y3'); // may not exist\n// after\nconst spId = 'x3y3';\nif (gd._fullLayout[spId] && gd._fullLayout[spId]._subplot) {\n  Plotly.Fx.hover(gd, evt, spId);\n}","handlingStrategy":"validation","validationCode":"function subplotExists(gd, spId) {\n  const fl = gd && gd._fullLayout;\n  return !!fl && (spId === 'xy' ? !!(fl.xaxis && fl.yaxis) : !!(fl[spId] && fl[spId]._subplot));\n}","typeGuard":"function isSubplotId(spId, gd) {\n  return typeof spId === 'string' && subplotExists(gd, spId);\n}","tryCatchPattern":"if (!subplotExists(gd, spId)) {\n  console.warn('skipping hover, missing subplot', spId);\n  return;\n}\nPlotly.Fx.hover(gd, evt, spId);","preventionTips":["Derive subplot ids from gd._fullLayout._subplots instead of hard-coding.","Re-check subplot existence after any relayout/deletes subplots.","Use correct cartesian id format ('x2y2'), not 'xy2' or 'x3y3' guesses.","Await Plotly.newPlot before calling hover so fullLayout is ready."],"tags":["hover","subplot","invalid-argument"],"backgroundTag":"invalid-subplot-id","analyzedSha":"1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314","analyzedAt":"2026-09-02T22:03:39.906Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}