plotly/plotly.js · error · Error
scene.js aspectRatio was not one of the enumerated types
Error message
scene.js aspectRatio was not one of the enumerated types
What it means
Fallback branch in the gl3d camera aspect-ratio computation. When layout.scene.aspectmode is 'auto', Plotly measures the axis scale ratios: if their max/min is <= 4 it uses the data-derived ratio, otherwise it falls back to the enumerated 'cube'/'manual' modes. The error fires when the resolved aspectmode string matches none of the enumerated types ('auto', 'data', 'cube', 'manual'), i.e. an unrecognized aspectmode value reached the scene code.
Source
Thrown at src/plots/gl3d/scene.js:807
axesScaleRatio[i] = Math.pow(axisRatio.acc, 1.0 / axisRatio.count) / dataScale[i];
}
if(aspectmode === 'data') {
aspectRatio = axesScaleRatio;
} else { // i.e. 'auto' option
if(
Math.max.apply(null, axesScaleRatio) /
Math.min.apply(null, axesScaleRatio) <= 4
) {
// USE DATA MODE WHEN AXIS RANGE DIMENSIONS ARE RELATIVELY EQUAL
aspectRatio = axesScaleRatio;
} else {
// USE EQUAL MODE WHEN AXIS RANGE DIMENSIONS ARE HIGHLY UNEQUAL
aspectRatio = [1, 1, 1];
}
}
} else {
throw new Error('scene.js aspectRatio was not one of the enumerated types');
}
/*
* Write aspect Ratio back to user data and fullLayout so that it is modifies as user
* manipulates the aspectmode settings and the fullLayout is up-to-date.
*/
fullSceneLayout.aspectratio.x = sceneLayout.aspectratio.x = aspectRatio[0];
fullSceneLayout.aspectratio.y = sceneLayout.aspectratio.y = aspectRatio[1];
fullSceneLayout.aspectratio.z = sceneLayout.aspectratio.z = aspectRatio[2];
/*
* Finally assign the computed aspecratio to the glplot module. This will have an effect
* on the next render cycle.
*/
scene.glplot.setAspectratio(fullSceneLayout.aspectratio);
// save 'initial' aspectratio & aspectmode view settings for modebar buttons
if(!scene.viewInitial.aspectratio) {View on GitHub (pinned to 1d090e0b5f)
Solutions
- Set scene.aspectmode to one of 'auto', 'data', 'cube', or 'manual'.
- Check for typos or programmatic values like null/undefined assigned to layout.scene.aspectmode.
- Use Plotly.validate or the schema to validate the layout before plotting.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/plots/gl3d/scene.js:807 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of plotly/plotly.js@1d090e0b5f (2026-09-02).
Data as JSON: /api/errors/982c78d916037b17.
Report an issue: GitHub.