I’m new to Julia / Atom / Juno. I’m excited about the possibilities, being an ex LISPer. Although something is a bit slow (Atom, JIT compilation?), it’s a pretty good user experience. The Juno debugger seems very well designed.
But then there are the plots. What I’m looking for, and think a lot of people are looking for, is the “matlab plotting experience”. Plots you can edit, but specifically zoom and pan the contents of the plot. I can do this with Matplotlib/Python/Spyder. It’s not exactly Matlab, but it is good enough.
I haven’t even been able to get a plot in Julia/Atom to appear in a separate pop-out window, much less get the contents to be zoomable and pannable. I’ve tried the gui() function and ENV[“PLOTS_USE_ATOM_PLOTPANE”] = false, but neither seem to work. I’m on MacOS Catalina.
Is what I’m after even possible? This issue seems to always be a stumbling block when trying to find a Matlab replacement.
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:
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.
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.
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.
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 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
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.
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
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:
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…
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.