vega-lite
vega-lite copied to clipboard
Add box-based zoom support for interval selections.
I spend a lot of time looking at engineering time-series data.
I currently use bokeh for this, but I would love to switch to vega/vega-lite/altair.
However, I'm hesitant to switch because vega appears to be missing a box-zoom feature. This feature is incredibly useful for exploratory time-series plotting/analysis.
As an example, my data often looks like a more complex version of this bokeh example.
There may be many phenomenon of different x/y axis scales which get manifested in time-series data and being able to change the zoom level/aspect ratio is incredibly useful.
Basically, I would love to see Bokeh's BoxZoomTool (as enabled in the box_annotaion example above) in vega/vega-lite/altair.
Thanks for posting! The good news is that what you describe is already expressible within Vega. Here is a modified zoomable scatterplot example. You can shift-drag to create a zoom region, and when you release the mouse button the view will snap to the new scale extents. You can also double click to restore the chart to the initial configuration. Note that this works alongside standard drag-pan and scroll-zoom interactions. Or, here is the same example within an Observable notebook: https://observablehq.com/@vega/vega-interactive-scatter-plot
The less good news is that I don't think this is currently expressible in Vega-Lite / Altair. However, I could imagine extensions to the interval selection logic that would change that. So, I'm going to rename this issue and transfer it over to the Vega-Lite repo for folks to look at there!
Oh cool! It's good to know that this is one step closer to being in Altair. Thanks for moving the bug over.
This feature would be great.
@allenjlee are you working on this? If not, let's unassign you.
Is there any alternative to getting interactive zooming of arbitrary regions of a plot working with vega-lite?
Is there any development on this yet? Thanks!
No updates yet, unfortunately. Sorry.
Is there any plan for this? Or is it just in the backlog with no plans at the moment? Thanks!
It's in the backlog but I think @kanitw wanted to address this issue so it's higher up in the queue. He can comment on the timing.
If this is not urgent, we should remove the P1.
It would be great and I understand many folks are waiting for this feature too. Having the hability to box-zoom is sometimes a must for some data exploration. So yeah, I'm really looking forward to this...
I'm looking forward to this too, if it's possible with Vega-lite. Thanks !
I'm also really looking forward to this feature. If there is any way I can help with this, let me know
Not quite the real thing, but a workaround is to zoom x- and y-axis independently via Selection projection and event filters depending on whether the shift key is held:
(in Altair)
selection_x = alt.selection_interval(
bind='scales',
encodings=["x"],
zoom="wheel![!event.shiftKey]",
)
selection_y = alt.selection_interval(
bind='scales',
encodings=["y"],
zoom="wheel![event.shiftKey]",
)
chart = (alt.Chart(...)
...
.add_selection(selection_x)
.add_selection(selection_y)
)
(in vega-lite)
{
...
"selection": {
"selectorx": {
"bind": "scales",
"encodings": [
"x"
],
"type": "interval",
"zoom": "wheel![!event.shiftKey]"
},
"selectory": {
"bind": "scales",
"encodings": [
"y"
],
"type": "interval",
"zoom": "wheel![event.shiftKey]"
}
},
}
Is there any development regarding this feature? I honestly can't wait to have it....
The lack of this feature is holding Altair back compared to plotly, bokeh, etc