Adding slider that will show a vertical line across my plot?

Hi all,

I have a stacked plot with shared x- and y- axes, and the main goal of this is to quickly see where general trends compare over each plot – and I think having a line over each plot that I can scan over would make comparison easier.

I can’t quite figure out how I would go about it using Makie.

Here’s is what I have so far:

unique_regions = unique(aveofave.Region)
unique_epochs = unique(aveofave.Epoch)

CairoMakie.activate!(type="png")

f = Figure(size=(1800, 1200));
kwargs = (xminorticksvisible = true, xminorgridvisible = true);

ax1 = Axis(f[1, 1]; xminorticks = IntervalsBetween(5), kwargs..., 
    ylabel = "Value", title = "Average of Averages", subtitle = "Regional Bin: $(unique_regions[1])");
ax2 = Axis(f[2, 1]; xminorticks = IntervalsBetween(5), kwargs..., 
    ylabel = "Value", subtitle = "Regional Bin: $(unique_regions[2])");
ax3 = Axis(f[3, 1]; xminorticks = IntervalsBetween(5), kwargs..., 
    ylabel = "Value", subtitle = "Regional Bin: $(unique_regions[3])");
ax4 = Axis(f[4, 1]; xminorticks = IntervalsBetween(5), kwargs..., 
    ylabel = "Value", xlabel = "Year", subtitle = "Regional Bin: $(unique_regions[4])");

linkyaxes!(ax1, ax2, ax3, ax4);
linkxaxes!(ax1, ax2, ax3, ax4);

for (i, ax) in enumerate([ax1, ax2, ax3, ax4])
    region = unique_regions[i]
    lines!(ax, aveofave[aveofave.Region .== region, :Epoch], 
        aveofave[aveofave.Region .== region, :AverageOfAverages],
        label = "Region: $region", linewidth = 3, colormap = :roma10)
end

f

Which yields the following plot, which I hope will give clearer picture of what I want to add. Thank you in advance for any help or advice!

using GLMakie
f = Figure()
lines(f[1,1], rand(10))
lines(f[2,1], rand(10))
is = IntervalSlider(f[3,1], range=1:10, startvalues=(4, 5))
vl = lift(x->x[1], is.interval)
vr = lift(x->x[2], is.interval)
vspan!(f[1,1], vl, vr)
vspan!(f[2,1], vl, vr)

1 Like

Thank you! I guess I completely missed that I have to use GLMakie.