daniel1noble / orchaRd

Extending the Orchard Plot for Meta-analysis
https://daniel1noble.github.io/orchaRd/
11 stars 6 forks source link

Point size as input of orchard_plot() #57

Open emilio-berti opened 8 months ago

emilio-berti commented 8 months ago

I would like to reduce the point size of the orchard_plot for a relatively small figure.

Example code:

library(tidyverse)
library(orchaRd)

set.seed(1230)

st <- expand.grid(sample(LETTERS, 10), sample(LETTERS, 10))
studies <- sapply(seq_len(nrow(st)), \(i) paste0(st[i, 1], st[i, 2]))
d <- tibble(
  x = rnorm(1e2, 5, 2), #effect size
  se_x = rnorm(1e2, 1, .1), #se of effect size
  name = studies, #study ID
  y = sample(letters[1:2], 1e2, replace = TRUE) #cat modulator
)
meta <- rma.mv(
  yi = x,
  V = se_x,
  mods = ~ y - 1,
  random = list(~ 1 | name),
  method = "REML",
  test = "t",
  dfs = "contain",
  data = d
)
p <- orchard_plot(
  object = meta, 
  mod = "y",
  group = "name",
  k = FALSE,
  g = FALSE,
  trunk.size = 5,
  branch.size = 1.5,
  twig.size = .5,
  xlab = "whatever"
)
ggsave("some-path.pdf", p, width = 3, height = 1.5)

orchard-example.pdf

I would like to be able to specify the bubble size range, so that I can make this figure small even for high number of bubbles (e.g., 100 effect sizes) without the bubbles being too big that it becomes hard to see each individual one (as in the figure). Alternatively, a solution in ggplot2 is also welcomed, but I couldn't find one.

daniel1noble commented 8 months ago

I can look into this, yes, but this looks like a device size issue as well. If you enlarge your plotting window it will auto adjust everything, then, you can save the figure a certain size. Use dev.size() to get the length and with and you can then add these into ggsave or other plotting windows.