Description
go.Table
seems to be fixed at using the plotly template, and using PX to change to other templates has no effect. Updating the plotly template even after switching to another PX default template changes the appearance of the table.
I couldn't figure out if the template go.Table
is using is set at a location that is not overwritten when changing the PX default template, or if the plotly template is hardcoded to always be used within the table function.
I appreciate that go.Table
is not a PX function, but since it seemingly is reading from a default template somewhere and the PX templates all specify Table colors, it would be useful if the Table appearance would change when the default PX template changes.
Here is an example of what I mean, note the comments.
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
# Plotly template
fig1 = go.Figure(data=[go.Table(header=dict(values=['A Scores', 'B Scores']),
cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]))])
fig1.show()
# Changing to ggplot2 doesn't anything
px.defaults.template = 'ggplot2'
fig2 = go.Figure(data=[go.Table(header=dict(values=['A Scores', 'B Scores']),
cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]))])
fig2.show()
# Updating the plotly template shows that go.Table is reading from the
# plotly template rather than ignoring templates altogether.
pio.templates['plotly'].data.table[0].cells.fill.color = 'orange'
fig3 = go.Figure(data=[go.Table(header=dict(values=['A Scores', 'B Scores']),
cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]))])
fig3.show()