我使用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"))
))
答案 0 :(得分:2)
我发现添加:
%>%
layout(title = "Text Title")
到最后一个“)之后的最后一步”“你的标题将显示在你的图表上方。
这是我遇到的问题,无法找到R中“标题”图表的答案,所以我想我会发布它。