我已使用ropensci/plotly库创建了一个表。我尝试了几种方法来添加标题。
这是我的代码:
library(plotly)
data <- read.csv("data.csv")
plot_ly(
type = 'table',
columnwidth = c(33, 32, 32),
columnorder = c(0, 1, 2),
header = list(
values = list(list(c("1st column")),
list(c("2nd column")),
list(c("3rd column"))
),
align = c("center", "center"),
line = list(width = 2, color = 'black'),
fill = list(color = c("blue", "blue")),
font = list(family = "Arial", size = 14, color = "white")
),
cells = list(
values = list(c(data$1st_column),c(data$2nd_column),c(data$3rd_column)),
align = c("center", "center"),
line = list(color = "black", width = 1),
font = list(family = "Arial", size = 12, color = c("black"))
))