在R中调整plotmo :: plot_glmnet的标题和标签图

问题描述 投票:0回答:1

我使用r包plotmo来可视化LASSO回归的系数收缩。默认情况下,它将添加标题为“自由度”的顶轴。如何删除标题或更改标题的内容?通常,如何调整plotmo::plot_glmnet绘制的上轴(包括标题和轴标签)?

library(glmnet)
library(plotmo) 
fit = glmnet(as.matrix(mtcars[-1]), mtcars[,1])
plot_glmnet(fit,xvar='lambda',label=7)

enter image description here

我尝试使用mtextaxis函数,但是没有用:

plot_glmnet(fit,xvar='lambda',label=7)
mtext('new top title', side=3)

enter image description here

r plot glmnet
1个回答
0
投票

您可以在[自由度]上添加标题,方法是为main的基础调用提供plot自变量:

plot_glmnet(fit,xvar='lambda',label=7, main = "new top title")
© www.soinside.com 2019 - 2024. All rights reserved.