Skip to content

aspectmode=data is incorrect when cones and scatter points are both involved #7143

Open
@alexcjohnson

Description

@alexcjohnson

See https://codepen.io/alexcjohnson/pen/ExBryzb?editors=0010

When all traces in this plot are shown, the square is not square:
Screenshot 2024-09-08 at 17 58 11

But if you click the legend to hide the cone trace, you do get a square:
Screenshot 2024-09-08 at 17 58 36

This is a pretty important bug for anyone making a plot representing real 3D space, as shapes will be distorted and the only workaround I could find is to abandon axis autorange: set explicit ranges for all three axes, set aspectmode: 'manual', and calculate aspectratio.{x, y, z} explicitly.

I haven't been able to reproduce this issue with only scatter3d traces, nor have I tried with other trace types or with just cones, but my guess is we're calculating the axis aspect ratios before adding extra padding to the ranges to accommodate the cones. Ironically it appears we don't pad the axes (not at all? not very much? I can't quite tell) for scatter3d points, but that's a separate issue.

As a side note: it would be nice if aspectratio or aspectmode docs stated that aspectratio is ignored when you set aspectmode: 'data'. I've seen users try to use this combination of attributes to create vertical exaggeration of topography, but this fails (and again, the only solution I can find is to calculate everything manually).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething brokensev-2serious problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions