2 questions:
-1- How* do I set the number format anf hover format for a ColorBar/ColorScale on a Scatter? I can set the number and hover formats for the x-axis and y-axis, but not the ColorBar.
- -2- How do I set the number and hover formats for the x, y, z axes on a Scatter_3d? The commands that work on a 2d scatter don’t seem to work on a 3d scatter.
Code to demo the problem listed below…
#--------------------------------------------------------------------------------------
import numpy as np
import pandas as pd
import plotly.express as px
df = pd.DataFrame(np.random.random((10,10)), columns=list('abcdefghij'))
print(df)
# How to get ColorScale numbers to show as %, like x and y axes?
# How to get ColorScale Hover Format to show as %, like it does for x and y axes hovers?
fig = px.scatter(df, x = 'a', y = 'b', color = 'd')
fig.update_xaxes(tickformat = ',.1%', hoverformat = ',.1%')
fig.update_yaxes(tickformat = ',.1%', hoverformat = ',.1%')
fig.update_traces(marker_colorbar_tickformat = ',.1%')
fig.show()
# How to change format of x and y axes numbers on 3d Scatter?
# Why is there no fig.update_zaxes property?
fig = px.scatter_3d(df, x = 'a', y = 'b', z = 'c', color = 'd')
fig.update_xaxes(tickformat = ',.1%', hoverformat = ',.1%')
fig.update_yaxes(tickformat = ',.1%', hoverformat = ',.1%')
fig.update_traces(marker_colorbar_tickformat = ',.1%')
fig.show()