I've generated some data and try to visualize them as two graphs in the same plot. One as a bar, the other one as a line.
However for some reason the graphs don't seem to overlap.
Here is my code:
# roll two 6-sided dices 500 times
dice_1 = pd.Series(np.random.randint(1, 7, 500))
dice_2 = pd.Series(np.random.randint(1, 7, 500))
dices = dice_1 + dice_2
# plotting the requency of a 2 times 6 sided dice role
fc = collections.Counter(dices)
freq = pd.Series(fc)
freq.plot(kind='line', alpha=0.6, linestyle='-', marker='o')
freq.plot(kind='bar', color='k', alpha=0.6)
And here is the graph.
The data set is the same however the line graph is moved two data points to the right (starts at 4 instead of 2). If I plot them separately, they show up correctly (both starting at 2). So what's different if I plot them in the same graph? And how to fix this?