I want to modify the rightmost number color from blue to white please help me
HI @sam_wang welcome to the forums.
Try this:
fig.update_coloraxes(
colorbar=dict(
title='Colorbar',
tickfont={'color':'white' },
titlefont={"color":'green'}
)
)
Thanks.I try this , but is still not working.
This is my code
fig = go.Figure(data=go.Heatmap(z=df.values))
fig.update_layout(
width=600,
height=600,
paper_bgcolor='rgba(0, 0, 0, 0.5)',
title=dict(
text='Daily Market Sentiment',
font=dict(
color='white'
)
),
xaxis=dict(
title='Dates',
title_font=dict(
color='white'
),
tickfont=dict(
color='white'
)
),
yaxis=dict(
title='Time',
title_font=dict(
color='white'
),
tickfont=dict(
color='white'
)
),
)
fig.update_coloraxes(
colorbar=dict(
title='Colorbar',
tickfont={'color':'white' },
titlefont={"color":'green'}
)
)
OK, you are using graph_objects
. I this case this should work:
import plotly.graph_objects as go
fig = go.Figure(data=go.Heatmap(
z=[[1, 20, 30],
[20, 1, 60],
[30, 60, 1]]))
fig.update_layout(
width=600,
height=600,
paper_bgcolor='rgba(0, 0, 0, 0.5)',
title=dict(
text='Daily Market Sentiment',
font=dict(
color='white'
)
),
xaxis=dict(
title='Dates',
title_font=dict(
color='white'
),
tickfont=dict(
color='white'
)
),
yaxis=dict(
title='Time',
title_font=dict(
color='white'
),
tickfont=dict(
color='white'
)
),
)
fig.update_traces(
colorbar=dict(
title='Colorbar',
tickfont={'color':'orange' },
titlefont={"color":'green'}
)
)
For the sake of completeness, here the plotly.express
version:
import plotly.express as px#
fig = px.imshow([[1, 20, 30],
[20, 1, 60],
[30, 60, 1]])
fig.update_layout(
width=600,
height=600,
paper_bgcolor='rgba(0, 0, 0, 0.5)',
title=dict(
text='Daily Market Sentiment',
font=dict(
color='white'
)
),
xaxis=dict(
title='Dates',
title_font=dict(
color='white'
),
tickfont=dict(
color='white'
)
),
yaxis=dict(
title='Time',
title_font=dict(
color='white'
),
tickfont=dict(
color='white'
)
),
)
fig.update_coloraxes(
colorbar=dict(
title='Colorbar',
tickfont={'color':'orange' },
titlefont={"color":'green'}
)
)
2 Likes
You are so great!!! Thank you !!!
1 Like