feat: Added annotations for weekly vaccination rate plot
This commit is contained in:
parent
4246649109
commit
6e93557250
1 changed files with 17 additions and 3 deletions
20
plot.py
20
plot.py
|
@ -361,10 +361,24 @@ def plot_vaccination_bar_graph_total_time_by_week():
|
|||
|
||||
print(type(w[0]), type(f[0]))
|
||||
|
||||
ax.bar(w, f, label='Wöchentliche Erstimpfungen', color='blue', width=6.8)
|
||||
ax.bar(w, s, label='Wöchentliche Zweitimpfungen', color='lightblue', width=6.8, bottom=f)
|
||||
bar1 = ax.bar(w, f, label='Wöchentliche Erstimpfungen', color='blue', width=6.8)
|
||||
bar2 = ax.bar(w, s, label='Wöchentliche Zweitimpfungen', color='lightblue', width=6.8, bottom=f)
|
||||
|
||||
#ax.set_ylim([0, np.max(f + s) * 1.1])
|
||||
for r1, r2 in zip(bar1, bar2):
|
||||
|
||||
x = r1.get_x() + r1.get_width() / 2.0
|
||||
|
||||
h1 = math.floor(r1.get_height() / 1000)
|
||||
h2 = math.floor(r2.get_height() / 1000)
|
||||
hg = math.floor((r1.get_height() + r2.get_height()) / 1000)
|
||||
|
||||
if h1 > 30:
|
||||
plt.text(x, h1 * 500, f'{h1:5n} k'.replace('.', ' '), ha='center', va='center', color='white')
|
||||
|
||||
if h2 > 30:
|
||||
plt.text(x, h1 * 1000 + h2 * 500, f'{h2:5n} k'.replace('.', ' '), ha='center', va='center', color='black')
|
||||
|
||||
plt.text(x, hg * 1000, f'{hg:5n} k'.replace('.', ' '), ha='center', va='bottom')
|
||||
|
||||
ax.legend(loc='upper left')
|
||||
ax.get_xaxis().set_major_formatter(DateFormatter('%Y-w%W'))
|
||||
|
|
Loading…
Reference in a new issue