# VPC subplot/facet title customization

**URL:** <https://discourse.pumas.ai/t/vpc-subplot-facet-title-customization/930>\
**Category:** How-to\
**Created:** [September 14, 2023, 9:01pm UTC](https://discourse.pumas.ai/t/vpc-subplot-facet-title-customization/930 "2023-09-14T21:01:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krina.mehta.bb](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@krina.mehta.bb](https://discourse.pumas.ai/u/krina.mehta.bb)\
**Post date:** [September 14, 2023, 9:01pm UTC](https://discourse.pumas.ai/t/vpc-subplot-facet-title-customization/930/1 "2023-09-14T21:01:20Z")

</div>

Hello Pumas team,

I have a vpc stratified by treatment arm in Pumas. I would like to update labels for the subplot titles. Can you please suggest how to do so?

Thanks!

vpc\_arm = vpc(model\_fit ; stratify\_by=[:TRT])

vpcplot = vpc\_plot(  
vpc\_arm;  
axis=(;  
ylabel=“”,  
xlabel=“”,  
),  
facet=(;  
combinelabels = true,  
),  
observations = false, observed\_ci=true, observed\_quantiles=true,  
observed\_color = “blue”, simquantile\_medians=true, simulated\_color=“black”,  
)

---

<div class="post-metadata">

**Author:** ![storopoli](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/storopoli/32/190_2.png) [@storopoli](https://discourse.pumas.ai/u/storopoli)\
**Post date:** [September 15, 2023, 12:00pm UTC](https://discourse.pumas.ai/t/vpc-subplot-facet-title-customization/930/2 "2023-09-15T12:00:15Z")

</div>

The way I’ve done this in the past was to inspect the underlying result from `vpc_plot`.

Here’s a MWE:

```julia
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:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/c52e1c2da8e4fc1824bf8fa6c0d2c9d1260788eb.jpeg)

Now if you go to the Julia extension and check for the contents of `f`, like in this image:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/81bafa3f5377540675e3a14555ed72643a374f67.png)

You’ll see that `f` has 4 `Makie.Axis` inside the `f.figure.content` vector.

Let’s dive into one of them:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/7c435d482003cdf12a75fe6acfa8160d5787fe87.jpeg)

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:

```julia
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:

```julia
notify(f.figure.content[1].title)

```

And voila, call `f` again to render the image and you’ll see:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/cac0b42ee371857891fca412b6325d676b5e0315.png)

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!

---

<div class="post-metadata">

**Author:** ![storopoli](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/storopoli/32/190_2.png) [@storopoli](https://discourse.pumas.ai/u/storopoli)\
**Post date:** [September 15, 2023, 2:32pm UTC](https://discourse.pumas.ai/t/vpc-subplot-facet-title-customization/930/3 "2023-09-15T14:32:05Z")

</div>

Here’s an improvement, thanks to @andreasnoack.

You can avoid the call to `notify` with:

```julia
content(f.figure[2,2]).title = "Plot 2,2"

```

This means that you can also use the much more intuitive grid index.
