mdb_ftl
mdb_ftl

Reputation: 443

How to format the breaks on x-axis in forest_model in R

I am using the forest_model function from the package forestmodel in R
I cannot figure out how to adjust the size and font of the breaks on the
x-axis as this does not appear to be a parameter in the function (forest_model), nor does it seem to be something that can be specified
in the panels parameter...

forest_model(fit, 
             panels = mypanels)

I would like the breaks to appear bold and size 12 font.
Any help much appreciated.

Upvotes: 1

Views: 1123

Answers (1)

Jakub Buček
Jakub Buček

Reputation: 101

Notice that the output of forest_model function is ggplot object which can be adjusted in the standard ggplot way.

I use the example provided by package forestmodel.

library(forestmodel)
library(survival)
library(dplyr)

pretty_lung <- lung %>%
  transmute(time,
            status,
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
           `Meal Cal` = meal.cal)

forest_model(coxph(Surv(time, status) ~ ., pretty_lung)) +
  theme(axis.text.x = element_text(size=12, face="bold"))

Upvotes: 2

Related Questions