I try to plot a grouped bar chart, by using python and the javascript lib plotly. My code looks like this:
import plotly.graph_objs as go
import plotly
traces = []
y = [[0, 2, 4, 6], [1, 3, 5, 7]]
for single_y in y:
traces.append(go.Bar(
x=['giraffes', 'orangutans'],
y=single_y
))
layout = go.Layout(
barmode='group'
)
fig = go.Figure(data=traces, layout=layout)
plotly.offline.plot(fig)
However, the result is not as expected. Because the y list of lists contains 4 values and therefore I would expected that all 4 values are mapped to the two x columns automatically.
What am I doing wrong here?