Hello,
splitting my hair around this and now I need some help. I’m sure it’s straightforward, but I can’t find the answer!
Here’s a MWE. It’s a list of subplots that creates multiple qqplot
over random values.
using StatsPlots
using Random
x = rand(1000)
y = rand(1000)
StatsPlots.plot(
qqplot(x, y),
qqplot(x,y))
It creates the following figure:
Now, I’m trying to add a fitted lines on each subplot. Here’s my code and what it produce (trying only on 1st subplot for this example).
using Polynomials
using Statistics
xq = quantile(x, range(0.0, stop=1.0, length=300))
yq = quantile(y, range(0.0, stop=1.0, length=300))
t1 = fit(xq, yq)
StatsPlots.plot(
plot(qqplot(x, y),
plot(t1,0.0:1.0, label=string("Slope = ", round(t1.coeffs[2], digits=3)))),
qqplot(x,y))
I tried with different combination where inside the 1st subplot I use plot!
, but without success.
Any help would be appreciated!