From this part of the documentation, I expected the following code to produce a bar graph, where each bars contain the corresponding text as per df['label']
. Instead, each bar contains the string found in df['Foo']
. How can I get the texttemplate
to work properly, i.e., have each bar contain the text from df['label']
?
>>> import plotly>>> import pandas as pd>>> import plotly.graph_objects as go>>> plotly.__version__ 5.17.0>>> df = pd.DataFrame(data={"Foo":['a','b','c'],'Bar':[2,5,10], 'label':['alpha','beta', 'charlie']})df Foo Bar label 0 a 2 alpha 1 b 5 beta 2 c 10 charlie>>> bar = go.Bar(x=df['Foo'], y=df['Bar'], texttemplate ="%{label}")>>> go.Figure(data=bar)