Zoomable and pannable plots (in a separate window)? (Atom/MacOS)

I don’t think it’s possible yet. However, since I started using Julia/Juno a few months ago, several things have improved & become more stable.
I try to contribute however I can:
Posting bugs, feature requests, & sometimes solutions.
Consider posting a feature request here:

Check out Makie.jl and my extension of it, MakieLayout.jl. GitHub - jkrumbiegel/MakieLayout.jl: Layouting for Makie.jl

This will give you plots that you can zoom and pan and MakieLayout.jl is even nicer than Matlab (in my totally biased opinion) for building up a layout of plots iteratively. You can add as many subplots in complex sub layouts as you want and they should be aligned perfectly relative to each other. You can also easily add interaction like sliders and buttons with a convenient syntax.

The packages are relatively new and in flux, though, so their APIs are not settled yet and are sometimes quite rough around the edges. But if you are curious we’d be happy to have you check them out and give us feedback if something doesn’t work.

2 Likes

I will check Makie.jl and MakieLayout.jl and report back. I like the spirit of what is going on with Julia, and the momentum. I had found a temporary Matlab replacement with PyLab, but it isn’t exciting and Julia seems “just right”, as long the ecosystem gets there.

Usually I do something like:

using Plots
plotly()

Using the plotly backend will open the plot either in Atom or in Chrome and you cand zoom,pan,hover or save the plot.

Makie looks very cool. I did get various warnings and error running the test. I’ll attach them to the makie.jl Github page.

I did run a couple simple examples and the contents of those plots don’t seem to be zoomable and pannable by default. Do you have a simple example that does make the contents zoomable and pannable?

plotly() does seem to be working, but I’m getting strange behavior. The first plot I did came up in the Safari browser. Then the second plot came up in the plot pane of Atom (but was zoomable and pannable, hooray).

Overall this is very encouraging.

Can someone tell me what the delays are when engaging new functionality, such as after running a Using statement for the first time and seeing the “precompiling” message? Is this just JIT compilation? Will these sorts of delays fade away as I get into a normal workflow? I’m doing a lot of new things, but often I’m waiting a long time for a few lines of Julia to complete.

You can call gui() after plot and it appears in Safari.

It is indeed JIT compilation latency, and currently there is no good way to avoid that. (You can start julia with julia --compile=min to get rid of much of the latency but then you won’t get the performance of JIT compiled code and that particular commandline option often has weird behavior from my experience.)

The whole issue of JIT latency has been extensively discussed elsewhere (see here and here for example).

You need the LAxis from MakieLayout.jl for zooming and panning :slight_smile: Short example to get you going:

using Makie
using MakieLayout

scene, layout = layoutscene()
display(scene) # or return scene to show it
ax = layout[1, 1] = LAxis(scene) # create axis and place in main layout
lines!(ax, 1:10, rand(10)) # draw lines into axis

ax2 = layout[1, 2] = LAxis(scene) # another scene next to the first one
heatmap!(ax2, rand(100, 100)) # draw a heatmap into that one
1 Like

This is looking great!!!

If I may:

Perhaps there is a way to have the zoom box a la plotly?

Also, AbstractPlotting.inline!(false) does not make it work in Juno plotpane, is it expected?

Box zoom is a good idea, I think that would need a flexible way to enable or disable though, because often in Makie you might want to have your own click-and-drag behavior for an axis and they shouldn’t clash. As an alternative, if you want to zoom x and y axes independently, you can just hold “x” or “y” while scrolling.

1 Like

If you use either the PyPlot package or the pyplot() backend for Plots, and you disable the plot pane in the Juno options, you will get a pop-out Matplotlib plotting window that lets you zoom and pan. This is what I use a lot of the time. With two monitors, I keep the Juno open in one and the plot window open in the other.

I get the following error when I try to run the code:

[ Info: Precompiling MakieLayout [5a521ce4-ebb9-4793-b5b7-b334dfe8393c]
ERROR: LoadError: LoadError: LoadError: UndefVarError: @lift not defined
Stacktrace:
[1] top-level scope
[2] include at ./boot.jl:328 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1105
[4] include at ./Base.jl:31 [inlined]
[5] include(::String) at /Users/andy/.julia/packages/MakieLayout/kxlvA/src/MakieLayout.jl:1
[6] top-level scope at /Users/andy/.julia/packages/MakieLayout/kxlvA/src/MakieLayout.jl:32
[7] include at ./boot.jl:328 [inlined]
[8] include_relative(::Module, ::String) at ./loading.jl:1105
[9] include(::Module, ::String) at ./Base.jl:31
[10] top-level scope at none:2
[11] eval at ./boot.jl:330 [inlined]
[12] eval(::Expr) at ./client.jl:425
[13] top-level scope at ./none:3
in expression starting at /Users/andy/.julia/packages/MakieLayout/kxlvA/src/lobjects/llegend.jl:28
in expression starting at /Users/andy/.julia/packages/MakieLayout/kxlvA/src/lobjects/llegend.jl:1
in expression starting at /Users/andy/.julia/packages/MakieLayout/kxlvA/src/MakieLayout.jl:32

You can try InspectDR.jl: It is designed for panning/zooming (and more) in a popup window. Note that it is also designed to work with large datasets.

GitHub - ma-laforge/InspectDR.jl: Fast, interactive Julia/GTK+ plots (+Smith charts +Gtk widget +Cairo-only images)

Issues

Apparently, there are still problems with the Gtk.jl module with respect to MacOS. I do not know why. However, if Gtk.jl works on your particular system, then InspectDR should work for you.

Interactivity Examples

In addition to pan/zoom capabilities (see section on keybindings in Readme.md), you can add “delta” markers and move them around with your mouse:

Also, you can create bode plots where the x axes are tied together, and overlay vertical/horizontal markers where needed:

Links

Sample plots can be found here:
https://github.com/ma-laforge/FileRepo/blob/master/InspectDR/sampleplots/README.md

And the files for creating them here:
https://github.com/ma-laforge/InspectDR.jl/tree/master/sample

There are more examples of plots generated with InspectDR here:
https://github.com/ma-laforge/FileRepo/blob/master/SignalProcessing/sampleplots/README.md

1 Like

That is weird, @lift is a macro in AbstractPlotting that should be available if you have that package. I’ve seen this before, though, the error just disappeared again and I don’t remember what the reason was. What are the versions that you’re using of MakieLayout and AbstractPlotting? It could be that something else holds MakieLayout back and you don’t get the version that correctly restricts AbstractPlotting to versions that have @lift

(v1.3) pkg> status MakieLayout
Status ~/.julia/environments/v1.3/Project.toml
[537997a7] AbstractPlotting v0.9.17 #master (GitHub - JuliaPlots/AbstractPlotting.jl: An abstract interface for plotting libraries, part of the Makie ecosystem.)
[5a521ce4] MakieLayout v0.2.15

Gaston.jl, which is based on gnuplot, supports plots in separate windows and pan/zoom. To zoom, select a region using the right mouse button. Panning works but is a bit clunky: the mouse wheel scrolls in the vertical direction, and shift-wheel in the horizontal direction.

If you run Gaston in Juno (or Jupyter), it will default to producing inline SVG plots, which can’t be zoomed/panned (at least not without some special javascript incantation that I haven’t tried to figure out). You should be able to plot in a separate window and re-gain zoom/pan support by running set(mode="normal") – I haven’t tested this, though; let me know if you try it and doesn’t work.

1 Like

Just installed a fresh environment with the exact same versions and don’t get that error… I don’t have an idea right now what the cause could be then

How do you come back to the initial configuration after a zoom/pan?

Ah I should add that to the docs… ctrl + mouse click, or call autolimits! on the axis

Gadfly can make free-standing SVG plots that have built-in pan/zoom interactivity using pure julia code (no C dependencies). to illustrate, click or shift-click on the color swatches in this example. hover in the plot and press the question mark (?) for a full list of capabilities.

i find it really convenient to be able to share such plots with colleagues who do not necessarily use julia. or even for my own use, to view them later without having to start julia and re-plot.