I need to add text to a plotly bubble chart with python. I can only get the text attribute to take 1 value per datapoint. However, for each datapoint I need to show two values on the tooltip: its size, and another value. I'm using a list of lists, loosely based on an example here.
This is my code:
bubbletext = dfenv[['Max_FZ','Argmax_FZ']] # dataframe with the 2 cols I need for text
bubbletext = bubbletext.values.tolist() # puts the df into list of lists
trace1 = Scatter(
x=dfenv['X (ft)'],
y=dfenv['Y (ft)'],
text=bubbletext, # here's the problem
mode='markers',
marker=Marker(
size=dfenv['Max_FZ'],
sizeref= dfenv['Max_FZ'].max() / 1e2**2,
sizemode='area'
)
)
data = Data([trace1])
layout = Layout(showlegend=False)
fig = Figure(data=data)#, layout=layout)
plot_url = py.plot(fig, filename='Envelope_MaxBubblechart')