Skip to content

Consistent "auto*" logic #1282

Closed
Closed
@alexcjohnson

Description

@alexcjohnson

We have a bunch of different auto* attributes scattered about.

  • Some control start/end/size type combinations (autocontour, autobin(x|y) -> {start, end, size}, ncontours/nbins(x|y) is also wrapped up here)
  • Some control just a range pair (autorange -> range:[min, max], heatmap.zauto -> zmin, zmax)
  • At least one other case too (autosize -> width, height).

The only unifying aspect seems to be that the behavior of 2 or 3 output attributes gets set by one auto attribute setting.

Right now they all work fine if you either set auto=true, or if you provide all of the resulting attributes. In #1280 (comment) we started discussing how to handle when you supply only some of the resulting attributes, and the proposal @etpinard and I seem to agree on is:

  • with auto*=true, you ignore whatever was provided for the other attributes, and generate them all fresh. Perhaps the only reason you'd need to do this is if you previously set some non-auto values and you want to toss them out.
  • with auto*=false, you accept whatever was provided for the other attributes, and fill in the rest. So if you want to provide one end of an axis or contour range, or you want to provide the contour size but not the range, you can do that and we'll figure out the rest.

And one extra piece that I think is true now but just for completeness:

  • In all of these situations we should copy the calculated values back to the input traces/layout. This is debatable, I guess, but it's important in practice right now because there are code paths (like restyle/relayout) where you can redo supplyDefaults without calling calc, which is nice because some of these auto calculations are expensive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions