# How to draw the lines connecting the subplots

**URL:** https://discourse.julialang.org/t/how-to-draw-the-lines-connecting-the-subplots/124540
**Category:** Visualization
**Tags:** plotting, plots
**Created:** [January 8, 2025, 3:10pm UTC](https://discourse.julialang.org/t/how-to-draw-the-lines-connecting-the-subplots/124540 "2025-01-08T15:10:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)
#### Post date: [January 8, 2025, 3:10pm UTC](https://discourse.julialang.org/t/how-to-draw-the-lines-connecting-the-subplots/124540/1 "2025-01-08T15:10:54Z")

</div>

I would like to draw the lines on top of a large composite plot constructed from several subplots using layout.

Specifically, I would like to draw the lines in the gap between the two plots to indicate that one of the subplots is a zoom-in of the second one.  
My problem is identical to the one discussed in [this post](https://discourse.julialang.org/t/plot-lines-in-the-gaps-between-subplots/80172). However, the solution suggested their (just add a subplot in between with the lines) does not work good in may case: I need to arrange the plots horizontally and the lines should intersect the axis label of one of the subplots.

**Is there a possibility to do that?**  
**As an alternative I thought I could create a separate figure with the lines and overlay it on top of my original figure, but is it again possible?**

---

<div class="post-metadata">

### Author: ![Sevi](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sevi](https://discourse.julialang.org/u/Sevi)
#### Post date: [January 9, 2025, 8:43am UTC](https://discourse.julialang.org/t/how-to-draw-the-lines-connecting-the-subplots/124540/2 "2025-01-09T08:43:00Z")

</div>

I could only find this:

> **[Lens · Plots](https://docs.juliaplots.org/v1.40/gallery/gr/generated/gr-ref040/)**
>
> Documentation for Plots.

```julia-repl
help?> lens!
search: lens! scalefontsize scalefontsizes leading_ones leading_zeros LinearIndices

  lens!([plot,] x, y, inset = (sp_index, bbox(x1, x2, y1, y2)))

  Magnify a region of a plot given by x and y. sp_index is the index of the subplot and x1, x2, y1 and y2 should be between 0 and 1.

```

I don’t know if it’s possible to somehow make the “inset” appear as a second subplot though…

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [January 9, 2025, 8:43am UTC](https://discourse.julialang.org/t/how-to-draw-the-lines-connecting-the-subplots/124540/3 "2025-01-09T08:43:19Z")

</div>

Another option in Plots.jl is to use insets.

For example:

 ![Plots_lines_connecting_insets](https://global.discourse-cdn.com/julialang/original/3X/6/4/64c1b247101d72274de82b3d3bd15a4e71fe8b76.png)

---

<div class="post-metadata">

### Author: ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)
#### Post date: [February 18, 2025, 2:12pm UTC](https://discourse.julialang.org/t/how-to-draw-the-lines-connecting-the-subplots/124540/4 "2025-02-18T14:12:40Z")

</div>

See: [Creating an Inset Plot | Makie](https://docs.makie.org/dev/tutorials/inset-plot-tutorial#5.-Plot-Data-in-the-Inset)

And MakieExtra’s zoom lines:  
[https://juliaaplavin.github.io/MakieExtraDocs.jl/notebooks/examples.html#3526c688-aea9-411b-a837-dc02ff81a7ee](https://juliaaplavin.github.io/MakieExtraDocs.jl/notebooks/examples.html#3526c688-aea9-411b-a837-dc02ff81a7ee)
