plotly-express-13-plotly操作表格
文本中介绍的是如何利用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.
主要的内容包含:
参考链接
https://plotly.com/python/figure-factory-table/
https://plotly.com/python/table/
plotly生成表格
通过自己给定的数据来生成表格:go.Table()
1 | number = np.random.randint(80,100,4) |
自定义表格样式
1 | fig = go.Figure(data=[go.Table( |
使用pandas 生成表格
图形工厂figure factory
给定数据创建
1 | import plotly.figure_factory as ff |
添加链接 和使用Latex公式
1 | data_matrix = [['User', 'Language', 'Chart Type', '# of Views', 'Equation'], # 第一行数据 |
使用pandas生成多个表格
1 | data = px.data.gapminder() |
缩小间隔
1 | fig = ff.create_table(df,height_constant=20) # 直接通过pandas创建 |
Table and Graph
demo(水平方向)
水平方向是根据相同的x轴来绘制的
1 | # 给定表格数据 |
demo(竖直方向)
竖直方向是根据y轴来确定的
1 | # Add table data |
自身数据
1 | df = pd.DataFrame({"name":["xiaoming","xiaohong","zhangshan","lisi"], |