Balance plot from R package CBPS

128 views Asked by At

is anyone here familiar with the 'Cobalt' package in R? I am trying to change the title of a balance plot (using bal.plot) and for some reason it's not taking the 'title' option. The default title Distributional Balance for "prop.score" is shown even when I try to customize.

My code is:

bal.plot(d, 
         var.name = "prop.score",
         which = "both",
         type = "density",
         mirror = TRUE,
         title = "Figure 1. Distributional Balance") + 
    theme_classic()

I thought it might be the theme_classic() but the problem persists regardless of whether that's included.

1

There are 1 answers

2
a_todd12 On BEST ANSWER

The solution is to just treat it like a ggplot object. Though I'm still not sure why my original code didn't work.

bal.plot(d, 
         var.name = "prop.score",
         which = "both",
         type = "density",
         mirror = TRUE) + 
    theme_classic() +
    labs(title = "Figure Title")