Thank you for the help. Here is what I have so far. Perhaps there are some improvments that could be made.

```
using Plots
n_rows = 5
n_cols = 5
x = [(rand(10), rand(10)) for _ in 1:n_rows, _ in 1:n_cols]
function compute_weights(n)
w = [0.15 ,fill(.85, n)...]
return w ./ sum(w)
end
p = plot(
legend = false, layout = grid(n_rows+1, n_cols+1,
heights = compute_weights(n_rows+1),
widths = compute_weights(n_cols+1)),
margin = .15Plots.cm,
size = (800, 800)
)
[plot!(p[r,1],(0,0),xlimits = (-1,1),ylimits=(-1,1),grid = false, axis=([], false)) for r in 1:n_rows+1];
[plot!(p[1,c],(0,0),xlimits = (-1,1),ylimits=(-1,1),grid = false, axis=([], false)) for c in 1:n_cols+1];
[scatter!(p[r,c], x[r-1,c-1], leg=false, xlabel = "x", ylabel = "y") for r in 2:(n_rows+1), c in 2:(n_cols+1)]
[annotate!(p[i,1], 0.0, 0.0, text("row$i", 10, :center, :center)) for i in 2:n_rows+1]
[annotate!(p[1,i], 0.0, 0.0, text("col$i", 10, :center, :center)) for i in 2:n_cols+1]
p
```

For some values of `n_rows`

and `n_cols`

, I encounter the following error:

```
ERROR: The sum of heights must be 1!
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] Plots.GridLayout(::Int64, ::Vararg{…}; parent::Plots.RootLayout, widths::Vector{…}, heights::Vector{…}, kw::@Kwargs{})
@ Plots ~/.julia/packages/Plots/ju9dp/src/layouts.jl:221
[3] grid(::Int64, ::Vararg{Int64}; kw::@Kwargs{heights::Vector{Float64}, widths::Vector{Float64}})
@ Plots ~/.julia/packages/Plots/ju9dp/src/layouts.jl:209
[4] top-level scope
```

which is due to numerical error, e.g.,

```
julia> sum(compute_weights(7))
1.0000000000000002
```

I suspect the following might be too strict:

```
if sum(heights) != 1
error("The sum of heights must be 1!")
end
```

Do you agree, or is there a better way to handle the problem?