I am creating a forest plot in R (code below) and want to transform my x-axis onto a log scale. However, my scale is not very balanced with the tick marks <1 more squished than the tick marks >1 (image below). How do I alter my code so that it looks more like the second image?
Code:
<code>death_forest <- forestplot(
labeltext = labeltext,
mean = forest_matrix[, 1],
lower = forest_matrix[, 2],
upper = forest_matrix[, 3],
align = "r",
boxsize = 0.5,
clip = c(0.01, 10),
xlab = "Odds Ratio for Death",
zero = 1, # Set the vertical line at 1 for odds ratios
vertices = TRUE,
lwd.ci = 2,
xticks = exp(seq(log(0.01), log(10), length.out = 4))
) |>
fp_set_style(
box = "lightblue3",
line = "lightblue3",
txt_gp = fpTxtGp(ticks = gpar(cex = 1), xlab = gpar(cex = 1))
) |>
fp_add_header(
Variable = "Variables",
Estimate = "OR",
CI = "CI"
) |>
fp_set_zebra_style("#f9f9f9") |>
fp_decorate_graph(graph.pos = 2)
</code>
<code>death_forest <- forestplot(
labeltext = labeltext,
mean = forest_matrix[, 1],
lower = forest_matrix[, 2],
upper = forest_matrix[, 3],
align = "r",
boxsize = 0.5,
clip = c(0.01, 10),
xlab = "Odds Ratio for Death",
zero = 1, # Set the vertical line at 1 for odds ratios
vertices = TRUE,
lwd.ci = 2,
xticks = exp(seq(log(0.01), log(10), length.out = 4))
) |>
fp_set_style(
box = "lightblue3",
line = "lightblue3",
txt_gp = fpTxtGp(ticks = gpar(cex = 1), xlab = gpar(cex = 1))
) |>
fp_add_header(
Variable = "Variables",
Estimate = "OR",
CI = "CI"
) |>
fp_set_zebra_style("#f9f9f9") |>
fp_decorate_graph(graph.pos = 2)
</code>
death_forest <- forestplot(
labeltext = labeltext,
mean = forest_matrix[, 1],
lower = forest_matrix[, 2],
upper = forest_matrix[, 3],
align = "r",
boxsize = 0.5,
clip = c(0.01, 10),
xlab = "Odds Ratio for Death",
zero = 1, # Set the vertical line at 1 for odds ratios
vertices = TRUE,
lwd.ci = 2,
xticks = exp(seq(log(0.01), log(10), length.out = 4))
) |>
fp_set_style(
box = "lightblue3",
line = "lightblue3",
txt_gp = fpTxtGp(ticks = gpar(cex = 1), xlab = gpar(cex = 1))
) |>
fp_add_header(
Variable = "Variables",
Estimate = "OR",
CI = "CI"
) |>
fp_set_zebra_style("#f9f9f9") |>
fp_decorate_graph(graph.pos = 2)