I’m using the ggconsort package to create a consort diagram for a study, and I want to include bullet points that are left-aligned within the boxes. The example provided in the ggconsort GitHub repository (https://github.com/tgerke/ggconsort) shows that it is possible to left-align bullet points in the final graph, but the steps for achieving this alignment are not fully explained.
Here is my code:
study_consort = study_cohorts %>%
consort_box_add(
name = "full", x = 0, y = 50, label = cohort_count_adorn(., .full)
) %>%
consort_box_add("eligible", 0, 40, cohort_count_adorn(., eligible)) %>%
consort_box_add("excluded", 30, 45,
glue::glue('<b>{cohort_count_adorn(study_cohorts, excluded)}</b><br>
• {cohort_count_adorn(study_cohorts, ineligible1)}<br>
• {cohort_count_adorn(study_cohorts, ineligible2)}<br>
• {cohort_count_adorn(study_cohorts, ineligible3)}<br>
• {cohort_count_adorn(study_cohorts, ineligible5)}<br>
• {cohort_count_adorn(study_cohorts, eligibleNA)}')) %>%
consort_box_add("enrolled", 0, 30, cohort_count_adorn(., enrolled)) %>%
consort_box_add("not.enrolled", 30, 35,
glue::glue('<b>{cohort_count_adorn(study_cohorts, not.enrolled)}</b><br>
• {cohort_count_adorn(study_cohorts, refusal1)}<br>
• {cohort_count_adorn(study_cohorts, refusal2)}<br>
• {cohort_count_adorn(study_cohorts, refusal3)}<br>
• {cohort_count_adorn(study_cohorts, refusal4)}<br>
• {cohort_count_adorn(study_cohorts, consentNA)}')) %>%
consort_box_add("referred", 0, 20, cohort_count_adorn(., referred)) %>%
consort_box_add("not.refer", 30, 25,
glue::glue('<b>{cohort_count_adorn(study_cohorts, not.refer)}</b><br>
• {cohort_count_adorn(study_cohorts, refer.pass)}<br>
• {cohort_count_adorn(study_cohorts, referNA)}')) %>%
consort_box_add("referred_BEH", 30, 15, cohort_count_adorn(., referred_BEH)) %>%
consort_box_add("referred_PARSA", -30, 15, cohort_count_adorn(., referred_PARSA)) %>%
consort_arrow_add(start = "full", start_side = "bottom",
end = "eligible", end_side = "top") %>%
consort_arrow_add(start = "eligible", start_side = "bottom",
end = "enrolled", end_side = "top") %>%
consort_arrow_add(start = "enrolled", start_side = "bottom",
end = "referred", end_side = "top") %>%
consort_arrow_add(end = "excluded", start_x = 0, start_y = 45) %>%
consort_arrow_add(end = "not.enrolled", start_x = 0, start_y = 35) %>%
consort_arrow_add(end = "not.refer", start_x = 0, start_y = 25) %>%
consort_line_add(start_x = 0, end_x = 0,
start_y = 30, end_y = 17) %>%
consort_line_add(start_x = -30, end_x = 30,
start_y = 17, end_y = 17) %>%
consort_arrow_add(start_x = -30, start_y = 17,
end = "referred_PARSA", end_side = "top") %>%
consort_arrow_add(start_x = 30, start_y = 17,
end = "referred_BEH", end_side = "top")
# Plotting the consort diagram
study_consort %>%
ggplot() +
geom_consort() +
theme_consort(margin_h = 8, margin_v = 1)
When I run this code, I get the following error:
vbnet
Copy code
Error in `ggtext::geom_richtext()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 3rd layer.
Caused by error:
! gridtext has encountered a tag that isn't supported yet: <div>
Only a very limited number of tags are currently supported.
Run `rlang::last_trace()` to see where the error occurred.
I tried to use the following tags to justify the bullet points to the left, but it seems that ggtext does not support them.
 
<div style="text-align: left;">
How can I left-align the bullet points within the consort boxes? Is there another way to format the text in ggtext or any other workaround that I can use to achieve left alignment for the bullet points?
Any guidance or suggestions would be greatly appreciated!