You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This forces the plot to treat differences between quantities in the $x$ and $y$ directions to display as equal distances: the visual units are the same in both directions. Plotly doesn't necessarily do this by default.
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 $y=x$. More importantly, I can see immediately that the absolute value of the slope of the curved orange line is less than 1 where it crosses the $y=x$ line. (This matters in my current use.)
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 $x$ and $y$ directions represent some domain-specific distances that viewers will intuitively understand. If that's worth supporting, then I am not sure whether it would be worthwhile for supporting the full functionality of 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.)
The text was updated successfully, but these errors were encountered:
mars0i
changed the title
Support axis scaleanchor and scaleratio
Support axis scaleanchor and scaleratio?
Mar 7, 2025
mars0i
changed the title
Support axis scaleanchor and scaleratio?
Support Plotly axis scaleanchor and scaleratio?
Mar 7, 2025
I think it would be useful to support the Plotly.js
scaleanchor
andscaleratio
properties in some way. There's a toy clojure illustration here.A common use for me, recently, is to set the ratio to 1:
This forces the plot to treat differences between quantities in the$x$ and $y$ directions to display as equal distances: the visual units are the same in both directions. Plotly doesn't necessarily do this by default.
A$y=x$ . More importantly, I can see immediately that the absolute value of the slope of the curved orange line is less than 1 where it crosses the $y=x$ line. (This matters in my current use.)
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 isThat'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
:scaleratio
s other than 1.However, I could imagine that someone might want some other ratio, for example if distances in the$x$ and $y$ directions represent some domain-specific distances that viewers will intuitively understand. If that's worth supporting, then I am not sure whether it would be worthwhile for supporting the full functionality of
scaleanchor
andscaleratio
, rather than only allowing the value ofscaleratio
to vary, in a use like that that I illustrate above. The full functionality ofscaleanchor
andscaleratio
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 usingassoc-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.)
The text was updated successfully, but these errors were encountered: