# Displaying plots alongside each other in Pluto

**URL:** <https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116>\
**Category:** General Usage\
**Tags:** pluto, vegalite\
**Created:** [December 23, 2024, 11:01am UTC](https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116 "2024-12-23T11:01:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![s-baumann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/s-baumann/32/5843_2.png) [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Post date:** [December 23, 2024, 11:01am UTC](https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116/1 "2024-12-23T11:01:34Z")

</div>

I have made plots in VegaLite. I want to display the plots alongside each other in a pluto notebook. The standard way to do this would be to combine the plots as below  
`Plots.plot(plot1, plot2, layout = (2,1))`  
but that does not work with VegaLite (the error is “Cannot convert VegaLite.VLSpec to series data for plotting”)

Anyone got any ideas? Is there a way to arrange Pluto cells alongside each other?

The code that illustrates the problem is below (TOML contents redacted for brevity):

````julia
# v0.20.4

using Markdown
using InteractiveUtils

# ╔═╡ b6eea494-c11b-11ef-2081-d91d6453fe0a
begin
	using VegaLite
	using Plots
	using DataFrames
end

# ╔═╡ 10c903d1-2d5d-4a90-836a-966b01aa6e13
begin
	x = collect(1:10)
	y = x .^ 2
	y2 = sqrt.(x)
end

# ╔═╡ 65712402-f526-44a1-af9c-329aee310ea0
function make_plot(x, y, lab)
    dd = DataFrame(x = x, y = y)
	p = dd |> VegaLite.@vlplot(
        title = "chart $lab",
        :line,
        x={field="x"},
        y={field="y"}
    )
	return p
end

# ╔═╡ 139ccb35-73e5-46f4-8bd0-1f9a71f16768
make_plot(x,y,"squared")

# ╔═╡ 0c320865-c5c3-483b-ad67-faccdd36b5df
Plots.plot(make_plot(x,y,"squared"), make_plot(x,y2,"sqrt"), layout = (2,1)) ```
````

---

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [December 24, 2024, 10:28am UTC](https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116/2 "2024-12-24T10:28:59Z")

</div>

Can you put two plots into a table environment?

---

<div class="post-metadata">

**Author:** ![g-gundam](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/g-gundam/32/47593_2.png) [@g-gundam](https://discourse.julialang.org/u/g-gundam)\
**Post date:** [December 25, 2024, 1:42am UTC](https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116/3 "2024-12-25T01:42:13Z")

</div>

Have you tried using `+` to combine multiple `@vlplot`s together?  
[https://www.queryverse.org/VegaLite.jl/stable/examples/examples\_repeat\_concatenation/](https://www.queryverse.org/VegaLite.jl/stable/examples/examples_repeat_concatenation/)

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [December 25, 2024, 7:40am UTC](https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116/4 "2024-12-25T07:40:40Z")

</div>

Should work with simple markdown:  
`md"$plot1 $plot2"`

---

<div class="post-metadata">

**Author:** ![s-baumann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/s-baumann/32/5843_2.png) [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Post date:** [December 28, 2024, 11:57am UTC](https://discourse.julialang.org/t/displaying-plots-alongside-each-other-in-pluto/124116/5 "2024-12-28T11:57:14Z")

</div>

Sorry for slow response, got tied up in Christmas.  
Thanks for these suggestions. I managed to get the table working as well as markout and making a vector of plots.  
The addition of the two plots did not work for me (it just displays the first of the two in that case)

 ![plotdisplay](https://global.discourse-cdn.com/julialang/original/3X/8/5/85ab6be5f27f9c7947e031470a11aefd257ee9fc.png)
