plot icon indicating copy to clipboard operation
plot copied to clipboard

Specify the min or max of a quantitative scale without specifying the whole extent

Open Fil opened this issue 2 years ago • 3 comments

Possibilities:

  • a min option and a max option.
  • support domain: [min, undefined] and domain: [undefined, max]
  • support domain as a function of the channels

min and max is more straightforward, but we'd have to decide what happens when people specify both a min and an explicit domain (a warning maybe?).

domain as a function opens lots of other possibilities (like custom “nicing”), which might be a pro or a con.

Fil avatar May 17 '23 18:05 Fil

Another feature would be to allow the user to specify values that must be in the domain; for example when you don't know exactly what the values will be in your dataset, but you absolutely want the domain to include [0, 10] — maybe just to create a scale that doesn't show “0, 0.5, 1, 1.5, 2.0” as ticks (related: #355 #1268).

Fil avatar Jul 11 '23 21:07 Fil

This suggestion seems related to your 2nd comment. But just to be sure we mean the same thing:

It would be useful if I could specify values that must be included on each axis, but the axis-ranges won't change unless necessary. For example:

Plot.plot({ x: { include: [10, 30] },
            y: { include: [-1000, +1000] }, ... });

If the data has x-values between 5 and 40, then the x-range won't change. But if the data only has x-values between 15 and 20, then the x-axis will be expanded to the desired range between 10 and 30. Similar for the y-range.

Hvass-Labs avatar Dec 06 '23 15:12 Hvass-Labs

See also https://github.com/observablehq/plot/discussions/1976#discussioncomment-8225654

Fil avatar Jan 23 '24 21:01 Fil