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
but if I change y="V" to y=alt.Y("V", scale=alt.Scale(domain=zoom)), the limits on the Y axis are set to the x-axis bounds of the selection rather than the y-axis bounds.
Going forward, we could probably make domain=zoom.x and domain=zoom.y shorthands for this, but we'd have to think about how this interacts with other places selection objects are used.
Would it make sense to automatically set 'encoding': 'y' as the default in usages like alt.Y(..., scale=alt.Scale(domain=selection))? And 'encoding': 'color' when used in alt.Color(..., scale=alt.Scale(domain=selection)), etc.
The selection object only has x and y encodings, so there's not generally a good way to guess user intent. I'd prefer to make it easier for the user to be explicit.
I took a look: the problem is that zoom.x is already shorthand to refer to the x attribute of the selection object within expressions, so any attribute-based approach to this would potentially break existing code.
I want to create a chart with a "minimap" similar to https://altair-viz.github.io/gallery/histogram_responsive.html, but where the selection is a box that I can click and drag (i.e.,
encodings=["x", "y"]
when callingselection_interval
).The zooming works along the x-axis if I recreate the example, setting
scale=alt.Scale(domain=zoom)
for the x-axis only:but if I change
y="V"
toy=alt.Y("V", scale=alt.Scale(domain=zoom))
, the limits on the Y axis are set to the x-axis bounds of the selection rather than the y-axis bounds.After looking at https://vega.github.io/vega-lite/docs/selection.html#scale-domains I found a workaround that does exactly what I want:
Is there a better way to do it though?
The text was updated successfully, but these errors were encountered: