MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.4k stars 310 forks source link

[FR] Allow x-only or y-only autolimits #1774

Open Datseris opened 2 years ago

Datseris commented 2 years ago

In interactive applications, often updating the axis limits is the most expensive part. At least for those in InteractiveDynamics.jl progressing the simulation is cheaper than changing the axis limits. Thus, we would like to call autolimits! as little as possible.

We know how to set the limits of the x-axis, but for y axis it is more convenient to call autolimits(x=false).

Datseris commented 2 years ago

By going to the source of the autolimits! function, I think I've found my solution:

    linkxaxes!(axs[end], axs[1:end-1]...)
    on(stepclick) do clicks
        xlims!(axs[1], Makie.MakieLayout.xautolimits(axs[1]))
        for ax in axs
            ylims!(ax, Makie.MakieLayout.yautolimits(ax))
        end
    end

So, I guess, this is a matter of adding convenience keywords to autolimits that call these two functions?

ffreyer commented 2 months ago

@jkrumbiegel I assume just making a version of https://github.com/MakieOrg/Makie.jl/blob/2b5931ee92c00603a669d02b8103bff49315024b/src/makielayout/blocks/axis.jl#L927-L930 that only sets one of the limits wouldn't work because we other could be nothing and triggering an update would then auto-limit both?