我正在尝试把这个头文件中的本Map像做得更大。我目前正在使用html代码来格式化R的gt表中的图像。
下面是我的代码示例:
library(tidyverse)
library(gt)
pizza_filename <- file.path("C:","
"Documents",
"pizza.png")
pizzaplace %>%
mutate(type = case_when(
type == "chicken" ~ "chicken (pizzas with chicken as a major ingredient)",
type == "classic" ~ "classic (classical pizzas)",
type == "supreme" ~ "supreme (pizzas that try a little harder)",
type == "veggie" ~ "veggie (pizzas without any meats whatsoever)",
)) %>%
mutate(size = factor(size, levels = c("S", "M", "L", "XL", "XXL"))) %>%
dplyr::group_by(type, size) %>%
dplyr::summarize(
sold = n(),
income = sum(price)
) %>%
gt(rowname_col = "size") %>%
tab_header(title = html(gt::local_image(pizza_filename), "<b>",
"Pizzas Sold",
"</b><br>", "in 2015")
) %>%
fmt_number(
columns = vars(sold),
decimals = 0,
use_seps = TRUE
)
图像可以正确显示(和保存),这是我之前关于这个问题的一个重大改进。但是,现在我希望图像跨越标题文本的两行,而不仅仅是一行,如下面输出中绘制的红色框所示。这可能吗?
1条答案
按热度按时间chy5wohz1#
我建议使用常规的html表格格式,如: