首页 > 解决方案 > 更改 bal.plot 生成的图例

问题描述

我对可能取 1/0 的因子变量对患者群体进行了倾向性分析

m.out = matchit(MatchedVar ~ Property1+Property2+Property3
                , data = PropensityDB, method = "nearest", ratio = 1)

并且想要绘制距离均值的新分布。我通过调用来做到这一点

bal.plot(m.out,var.name = "distance", which = "both")

并得到下图:

在此处输入图像描述

我想将“治疗”标题更改为其他名称以正确命名组。

尝试了几种方法,但无法解决这个问题。

有任何想法吗?

标签: r

解决方案


bal.plot 创建一个可以作为所有 ggplot 对象操作的 ggplot 对象:

p <- bal.plot(m.out,var.name = "distance", which = "both")
p + scale_fill_discrete(name = "MatchedVar")

推荐阅读