文本中介绍的是如何利用plotly来操作表格,使用的go.Table方法
go.Table provides a Table object for detailed data viewing. The data are arranged in a grid of rows and columns. Most styling can be specified for header, columns, rows or individual cells. Table is using a column-major order, ie. the grid is represented as a vector of column vectors.
主要的内容包含:
image
参考链接
plotly生成表格
通过自己给定的数据来生成表格:go.Table()
number = np.random.randint(80,100,4)
# print(number)
fig = go.Figure(data=[go.Table(
header=dict(values=['A Scores', 'B Scores']), # 设置表头
cells=dict(values=[number, # 通过numpy给定数据
[95, 85, 75, 95]]))
]
)
fig.show()
image
自定义表格样式
fig = go.Figure(data=[go.Table(
header=dict(values=['A Scores', 'B Scores'],
line_color='darkslategray',
fill_color='lightskyblue',
align='left'),
cells=dict(values=[[100, 90, 80, 90], # 1st column
[95, 85, 75, 95]], # 2nd column
line_color='darkslategray',
fill_color='lightcyan',
align='center'))
])
fig.update_layout(width=600, height=300)
fig.show()
image
使用pandas 生成表格
image-20200706150503434
image-20200706150600178
图形工厂figure factory
给定数据创