Hi everyone
I wonder how I could put an image in the title of this gt table
Any suggestion?
Thank you
Hi everyone
I wonder how I could put an image in the title of this gt table
There is an example here:
With a link to the code: This gt code allows you to make a summary table based on the `pizzaplace` dataset. ยท GitHub
Not sure if that is some sort of emoji code though.
Thank you williaml
Finally I fix my problem insert html code in the title,
l_b <- lebron %>% mutate(tm = ifelse(age <= "25", "CLE1", tm),
tm =ifelse(age <="33" & age>="30","CLE2", tm)) %>% left_join(nbalogos2021, by = c("tm"= "shortsnames")) %>%
select(pts:g, age, logos) %>%
gt() %>%
tab_header(
title = md("<img src='https://ak-static.cms.nba.com/wp-content/uploads/headshots/nba/latest/260x190/2544.png' style='height:30px;'> **Lebron James**"),
subtitle = md("Totales en 18 temporadas"))%>%
cols_align(
align = "center",
columns = 1
) %>%
cols_align(
align = "left",
columns = 2
) %>%
cols_align(
align = "center",
columns = 3
) %>%
cols_align(
align = "center",
columns = 4
) %>%
cols_align(
align = "center",
columns = 5
) %>%
cols_label(pts = ("Puntos"),
mp= md("Minutos"),
g = md("Partidos"),
age= md("Edad"),
logos = md("Equipos")) %>%
data_color(
columns = vars(pts),
colors = scales::col_numeric(
palette = c( "#f7f7f7", "#7fbf7b"),
domain = NULL
) )%>%
text_transform(
locations = cells_body(vars(logos)),
fn = function(x) {
web_image(url = x)
}
) %>%
tab_options(
table.background.color = "white",
column_labels.font.size = 11.5,
column_labels.font.weight = "bold",
row_group.font.weight = NULL,
row_group.background.color = "#E5E1D8",
table.font.size = 9,
heading.title.font.size = 18,
heading.subtitle.font.size = 12.5,
table.font.names = "Consolas",
data_row.padding = px(2)) %>%
tab_source_note(
source_note = md(" <br> <br>
"))
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.