Quantcast
Channel: ЁЯОЫя╕П Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271
тЖз

How does a heatmap's font_colors attribute work?

$
0
0

I created the following heatmap:

I want the font color of the green cells to be white, and the red+yellow cells to be black. IтАЩm not sure why itтАЩs making the first five or so cells white, and I couldnтАЩt find anything in the documentation about how font_colors is supposed to work.

My code:

        z=z,
        annotation_text=z_labels,
        # colorscale='rdylgn',
        colorscale=['red', 'yellow', 'green'],
        font_colors=['black', 'black', 'white'],
        zmid=60,
        zmin=0,
        zmax=120,
        x=price_levels,
        y=days,
        xgap=1,
        ygap=1,
    )

    fig['layout']['yaxis']['autorange'] = "reversed"
    fig['layout']['yaxis']['fixedrange'] = True
    fig['layout']['yaxis'].update(side="left")

    fig['layout']['xaxis']['fixedrange'] = True
    fig['layout']['xaxis'].update(side="top")
    fig.update_yaxes(nticks=n_days, ticktext=y_labels, tickvals=days, title_text='Days to Expiration (DTE)')
    fig.update_xaxes(nticks=len(price_levels), ticktext=x_labels, tickvals=price_levels, title_text='Purchase Price')```

1 post - 1 participant

Read full topic

тЖз

Viewing all articles
Browse latest Browse all 6271

Trending Articles