The way I’ve done this in the past was to inspect the underlying result from vpc_plot.
Here’s a MWE:
using Pumas
using PumasUtilities
using PharmaDatasets
pkdata = dataset("iv_sd_3")
population = read_pumas(pkdata; covariates=[:dosegrp])
model = @model begin
@param begin
tvcl ∈ RealDomain(; lower = 0.001) # typical clearance
tvvc ∈ RealDomain(; lower = 0.001) # typical central volume of distribution
Ω ∈ PDiagDomain(2) # between-subject variability
σ ∈ RealDomain(; lower = 0.001) # residual variability
end
@random begin
η ~ MvNormal(Ω)
end
@covariates dosegrp
@pre begin
CL = tvcl * exp(η[1])
Vc = tvvc * exp(η[2])
end
@dynamics Central1
@derived begin
cp = @. 1000 * Central / Vc
dv ~ @. Normal(cp, cp * σ)
end
end
params = (tvcl = 1.0, tvvc = 10.0, Ω = Diagonal([0.09, 0.09]), σ = 0.3)
fit_results = fit(model, population, params, FOCE())
fit_vpc = vpc(
fit_results; # Multi-Threaded
ensemblealg = EnsembleThreads(),
stratify_by = [:dosegrp],
)
f = vpc_plot(fit_vpc)
This produces:
Now if you go to the Julia extension and check for the contents of f, like in this image:
You’ll see that f has 4 Makie.Axis inside the f.figure.content vector.
Let’s dive into one of them:
Hey, there’s a title thing with a val which is the same as our title from the first axis in your plot…
Let’s try to change this:
f.figure.content[1].title.val = "Change title 1"
However, this does not change our underlying figure f.
We need to “notify” Makie that things have changed.
We do this with the notify function on whatever we are changing:
notify(f.figure.content[1].title)
And voila, call f again to render the image and you’ll see:
It works.
Now we can change anything inside the Makie.Axis objects, just don’t forget to call notify on it.
I hope this helps you, Krina!