%matplotlib inline
import pandas
import matplotlib.pyplot as plt
# load the data from Redmine
key = 'XXX'
data = pandas.read_csv('https://redmine/projects/XXX/issues.csv?query_id=XXX&key={key}'.format(key=key))
# Plot the velocity
velocity = data[data['Target version'] != 'Backlog']\
.groupby('Target version', as_index=True)['Story Points'].sum()
avg_velocity = pandas.rolling_mean(velocity, window=5, min_periods=1)
ax = velocity.plot(kind='bar', color='steelblue', label="Velocity",
legend=True, title="Velocity", figsize=(12,8))
avg_velocity.plot(ax=ax, color='r', style='.-', label="Average velocity (window=5)",
legend=True)
ax.xaxis.grid(False)