-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I think it would be useful to support the Plotly.js scaleanchor and scaleratio properties in some way. There's a toy clojure illustration here.
A common use for me, recently, is to set the ratio to 1:
(-> plot
plotly/plot
(assoc-in [:layout :yaxis :scaleanchor] :x)
(assoc-in [:layout :yaxis :scaleratio] 1)))
This forces the plot to treat differences between quantities in the
A scaleratio of 1 is useful when plotting mathematical equations. For example, it may be important to know whether the slope of a curve is above or below 1. :scaleratio 1 means that a line with slope equal to 1 displays as a line at a 45 degree angle, as one would expect. In the image above, one can see immediately that the green line from lower left to upper right is
That's my recent use case, but :scaleratio 1 could also be useful in some cases for quick visual inspection of regressions and other curve-fitting.
One option would be to have a keyword with a boolean value to set the ratio to 1, or to leave it to vary. I don't currently have any uses for :scaleratios other than 1.
However, I could imagine that someone might want some other ratio, for example if distances in the scaleanchor and scaleratio, rather than only allowing the value of scaleratio to vary, in a use like that that I illustrate above. The full functionality of scaleanchor and scaleratio allows one to use alternative axes, but that's more confusing (I don't fully understand it yet), and there's always the fallback of using assoc-in.
I don't have strong opinions about the best way to do this.
(By the way, I have never figured out how to do this in Vega-lite. There are methods that seem like they should work, but they don't consistently do so. Vega-lite sets the ratios the way it wants. The fact that Plotly allows forcing the visual ratio to 1 is the main reason I'm rewriting some Vega-lite code for use with Tableplot Plotly.)
