The data label for the 2nd of 3 bars in my bar chart is misrendering and Iām looking for assistance to get it fixed. Below is an image and the code:
#graph plot
import plotly.plotly as py
import plotly.graph_objs as go
import plotly
plotly.tools.set_credentials_file(username='bjpreisler', api_key='TnyV5yYf2ijrjWqEv0eu')
trace1 = go.Bar(
x=['Sept DMs','Current Month DMs', 'April Goal DMs'],
y=[sept,current_DMs, goal_17],
marker=dict(
color=['rgb(55, 83, 109)', 'rgb(55, 83, 109)',
'rgb(185,211,238)']),
)
x = ['Sept DMs','Current DMs', 'April Goal DMs']
y = [sept,current_DMs,goal_17]
data = [trace1]
layout = go.Layout(
annotations=[
dict(x=xi,y=yi,
text=str(yi),
xanchor='center',
yanchor='bottom',
showarrow=False,
) for xi, yi in zip(x, y)],
title='%s DM Progress' %name,
xaxis=dict(
tickfont=dict(
size=14,
color='rgb(107, 107, 107)'
)
),
yaxis=dict(
title='DM',
titlefont=dict(
size=16,
color='rgb(107, 107, 107)'
),
tickfont=dict(
size=14,
color='rgb(107, 107, 107)'
)
),
legend=dict(
x=0,
y=1.0,
bgcolor='rgba(255, 255, 255, 0)',
bordercolor='rgba(255, 255, 255, 0)'
),
bargap=0.1,
bargroupgap=0.3
)
fig = go.Figure(data=data, layout=layout)
py.image.save_as(fig, filename= c[0] + '.png')
from IPython.display import Image