ACCLAB / dabestr

Data Analysis with Bootstrap Estimation in R
https://acclab.github.io/dabestr
Apache License 2.0
215 stars 34 forks source link

Legend removing #156

Closed alunats closed 8 months ago

alunats commented 11 months ago

I would like to ask if there is any way to remove the legend for a chart with the "colour" option? Example below

multi_baseline_repeated_measures.mean_diff <- load(df, x = Group, y = Measurement, colour = Gender, idx = list( c( "Control 1", "Test 1", "Test 2", "Test 3" ), c( "Control 2", "Test 4", "Test 5", "Test 6" ) ), paired = "baseline", id_col = ID ) %>% mean_diff()

dabest_plot(multi_baseline_repeated_measures.mean_diff, raw_marker_size = 0.5, raw_marker_alpha = 0.3 )

sunroofgod commented 10 months ago

Hi @alunats!

Unfortunately, the CRAN version v2023.9.12 of dabestr does not offer the ability to remove legends via the dabestr API.

However, the latest development version of dabestr does. You may update your version of dabestr to the development version via:

devtools::install_github(repo = "ACCLAB/dabestr", ref = "dev")

By adding "show_legend = FALSE" into the dabest_plot() function, you may remove all legends. For example, as per your code example:

multi_baseline_repeated_measures.mean_diff <- load(df,
  x = Group, y = Measurement, colour = Gender,
  idx = list(c("Control 1", "Test 1", "Test 2", "Test 3"),
             c("Control 2", "Test 4", "Test 5", "Test 6")),
  paired = "baseline", id_col = ID
  ) %>%
  mean_diff()

dabest_plot(multi_baseline_repeated_measures.mean_diff,
  raw_marker_size = 0.5, raw_marker_alpha = 0.3,
  show_legend = FALSE # Removes colour legend
)