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

**URL:** https://discourse.julialang.org/t/adding-slider-that-will-show-a-vertical-line-across-my-plot/122605
**Category:** Visualization
**Tags:** cairomakie
**Created:** [November 13, 2024, 7:54pm UTC](https://discourse.julialang.org/t/adding-slider-that-will-show-a-vertical-line-across-my-plot/122605 "2024-11-13T19:54:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![GeodeticR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geodeticr/32/218661_2.png) [@GeodeticR](https://discourse.julialang.org/u/GeodeticR)
#### Post date: [November 13, 2024, 7:54pm UTC](https://discourse.julialang.org/t/adding-slider-that-will-show-a-vertical-line-across-my-plot/122605/1 "2024-11-13T19:54:39Z")

</div>

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:

```julia
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!

 ![ave_of_ave_vert_stack](https://global.discourse-cdn.com/julialang/original/3X/5/c/5c4f6f0fbfd11985f82b66173a7bb3e1e651833e.png)

---

<div class="post-metadata">

### Author: ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)
#### Post date: [November 13, 2024, 9:43pm UTC](https://discourse.julialang.org/t/adding-slider-that-will-show-a-vertical-line-across-my-plot/122605/2 "2024-11-13T21:43:34Z")

</div>

```julia
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)

```

 ![Screenshot 2024-11-13 at 4.43.04 PM](https://global.discourse-cdn.com/julialang/original/3X/2/6/2624e67a4c77bb719e6b83098209c45b2b010953.png)

---

<div class="post-metadata">

### Author: ![GeodeticR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geodeticr/32/218661_2.png) [@GeodeticR](https://discourse.julialang.org/u/GeodeticR)
#### Post date: [November 20, 2024, 4:39am UTC](https://discourse.julialang.org/t/adding-slider-that-will-show-a-vertical-line-across-my-plot/122605/3 "2024-11-20T04:39:11Z")

</div>

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