Is infinite figure zoom possible (i.e. callback to refresh figure data)?


#1

Several of the backends to Plots.jl provide interactive pan & zoom. However (as far as I can tell) they only work with the original figure data, so the figure looks pixelized and ugly when zoomed in sufficiently. Is there any backend that allows a callback function to refresh the figure using the zoomed axes so that everything still looks pretty when zoomed?

If this is impossible with Plots.jl, is there another way to do it? I don’t need advanced chart types, just scatter plots and heatmaps.


#2

The plotly(js) and pyplot backends both allow that, as does inspectdr - but you need the native plotting window (plot from the REPL, or use gui() in Juno, though there’s been issues with that).


#3

That’s great! Is there a simple example that shows how to define the callback in say plotlyjs? I couldn’t find anything in the documentation. If there is none written yet and it’s too hard to explain then please just tell me what the relevant parameters are called and I’ll try to figure it out from the source code.


#4

Sorry you can’t define callback with the backends. That is a Plots issue. But they allow infinite zoom natively.


#5

Zooming also works with the pyplot() backend (from the REPL). But the axis ticks are not redrawn when zooming in (neither for plotly nor pyplot). (Or is that an issue with my setup?) That is one of the reasons why I often end up using straight PyPlot.jl, where that works.


#6

On the latest Plots.jl master, you can use ticks=:native, courtesy of @apalugniok.

I believe you could use PlotlyWebIO.jl, and addtrace to add more data to the plot upon zooming (Plotly has events you can hook into). Beware: PlotlyWebIO.jl is unreleased and undocumented at the moment. I was able to do all I wanted (interactive modification of data using the selection tool), but it took a lot of digging into the Plotly web API, and into WebIO.jl.