Offline Tables, set font or background color on individual cells?


In a Plotly Table (offline), Is there a way to specify the color for either the font or background of a particular cell? I see examples for colorscale, and setting entire rows, but I would like to set it for an individual cell. HTML “<font color…” did not seem to work. Would like the color to be set based on the value of the data if possible

Thank you.

1 Like

#Imagine the table as a heatmap. For manipulating the shown values you have to set the annotations.
For setting the font color, e.g. positive values -> green // negative values -> red

for i in range(len(table.layout.annotations)):
        if float(table.layout.annotations[i]['text']) > 0.:
        elif float(table.layout.annotations[i]['text']) < 0.:
    except: #if cell has no value

I have not tested the following, but this is my idea:
For changing the cell, you have to set the z-coordinate of the table data to make use of the colorscale.
You get the data with this command:[0]['z']
For a correct implementation of the colorscale you have to scale your table data to values between 0 and 1 and overwrite the z-coordinate with these.