如何导出没有背景(不透明)的 plotly table?
How can I export a plotly table without a background (not transparent)?
我试图用 plotly lib 制作一个 table,在导出时,我意识到它导出了带有背景的 table,所以我决定让背景透明,但是它结果我需要在没有背景的情况下导出 table。这是我试过的:
layout = dict(
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)'
)
fig = go.Figure(layout=layout, data=[go.Table(
header=dict(values=['A Scores', 'B Scores'],
line_color='darkslategray',
fill_color='lightskyblue',
align='center'),
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=350, height=350)
fig.show()
结果:
我期待的是:
从您的屏幕截图来看,您真正指的是边距。这些可以设置为零
fig.update_layout(width=350, height=350, margin={"l":0,"r":0,"t":0,"b":0})
我试图用 plotly lib 制作一个 table,在导出时,我意识到它导出了带有背景的 table,所以我决定让背景透明,但是它结果我需要在没有背景的情况下导出 table。这是我试过的:
layout = dict(
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)'
)
fig = go.Figure(layout=layout, data=[go.Table(
header=dict(values=['A Scores', 'B Scores'],
line_color='darkslategray',
fill_color='lightskyblue',
align='center'),
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=350, height=350)
fig.show()
结果:
我期待的是:
从您的屏幕截图来看,您真正指的是边距。这些可以设置为零
fig.update_layout(width=350, height=350, margin={"l":0,"r":0,"t":0,"b":0})