plot.rescale
This is a first cut at an alternate take to zooming, focusing on the programmatic API first rather than the interaction. This exposes a plot.rescale method that takes scale definitions, allowing scales to be modified after a plot is rendered; the plot is re-rendered in place with the new scale definitions.
For zooming, we would use plot.rescale to redefine the x and y domains (or, in the case of an ordinal position scale, we might redefine the range instead). But the plot.rescale method could have other uses as well, such as adjusting the r scale as you zoom in or out, switching from a linear to a log scale, redefining the color scale to highlight certain elements, and so on.
Additionally, it should be simpler to sketch this if we focus on the programmatic API first. We should be able to easily implement interactive zooming and zoom transitions on top of this API. Here is a little demo of a panning animation:
https://github.com/user-attachments/assets/9d8aae3a-c275-45c8-b267-2ff4da2bb223
The implementation so far is as minimal as I could make it. A new plot is rendered with the new options, and then the contents of the old plot are replaced with the contents of the new plot. I don’t think this approach will work as-is (for example, I think it breaks the tip mark); but I think we can make a smarter, faster implementation that has the same API.
We also need to figure out what scale options are valid to pass to plot.rescale. Since these options are merged not with the original options, but with the materialized scales, the results may not be what you expect; for example, passing the scheme option for a color scale typically has no effect because it is lower priority than the materialized range or interpolate option.
Fixes #1590.
Previously #2083 #1964 #1738.