I have a dataframe (x,y,z), i want to plot:
- x vs y,
- display z value as hovertext, with label 'z'.
I can get it to display z value but would like to add a label 'z: ' before the value to clarify what it is. This is the code so far
import plotly.graph_objects as go
df=pd.DataFrame({'x':[0, 1, 2, 3, 4, 5, 6, 7, 8],
'y':[0, 11, 31, 21, 41, 31, 41, 61, 51],
'z':[0,2,4,6,7,8,9,10,12] })
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(go.Scatter(
x=df['x'],
y=df['y'],
hovertext=df['z'] #displays hover value
#somehting like: hoverlabel='Z :'
))