Skip to content

add option for log color scale with px.imshow #3735

Open
@janosh

Description

@janosh

To better distinguish similar values, it would be nice if the color scale of px.imshow() could be made logarithmic without changing the values by displayed text_auto=True.

Closest I've found so far is to np.log the df and change the color bar ticks:

df_log = np.log10(df)

fig = px.imshow(
    df_log,
    text_auto=True,
)

ticks = [1, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01]
vals = np.log10(ticks)
fig.update_layout(coloraxis_colorbar=dict(tickvals=vals, ticktext=ticks))

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions