jkrumbiegel / MakieLayout.jl

Layouting for Makie.jl
https://jkrumbiegel.github.io/MakieLayout.jl/stable/
MIT License
50 stars 9 forks source link

[Doc] How to "auto-readjust" axis limits for interactive plotting? #67

Closed Datseris closed 4 years ago

Datseris commented 4 years ago

Hi, I am doing something simple like:

tsax = layout[end+1, :] = LAxis(scene)
tsobs = Observable(zeros(size(A, Time)))
lines!(tsax, 1:size(A, Time), tsobs)

on(spoint) do  pos
    i = findnearest(pos[1], lon)
    j = findnearest(pos[2], lat)
    tsobs[] = Array(A)[i, j, :]
end

I.e. I am plotting a line on an axis and then interactively I change the line to something else. But, unfortunately, this doesn't readjust the y-axis. I guess that there is a command to do this, but I couldn't find it in the docs.

Datseris commented 4 years ago

To clarify: I can of course set the ylimits in the on code block, but I am searching for the "nice autolimiter" function that also adds a little pad between data and splines, something like readjust_limits!(ax).

jkrumbiegel commented 4 years ago

autolimits!(ax), although now I'm wondering if I made a specific one just for x or y?

Datseris commented 4 years ago

Thanks this is what I wa s looking for