fix: Fix NaN in rect heights of weekly vaccination rates
This commit is contained in:
parent
1c47eff06d
commit
2b29e2f915
1 changed files with 8 additions and 3 deletions
11
plot.py
11
plot.py
|
@ -388,13 +388,18 @@ def plot_vaccination_bar_graph_total_time_by_week():
|
|||
|
||||
i = 0
|
||||
|
||||
nan_to_zero = lambda x: 0 if math.isnan(x) else x
|
||||
|
||||
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)
|
||||
rh1 = nan_to_zero(r1.get_height())
|
||||
rh2 = nan_to_zero(r2.get_height())
|
||||
|
||||
h1 = math.floor(rh1 / 1000)
|
||||
h2 = math.floor(rh2 / 1000)
|
||||
hg = math.floor((rh1 + rh2) / 1000)
|
||||
|
||||
if h1 > 30:
|
||||
plt.text(x, h1 * 500, f'{h1:5n} k'.replace('.', ' '), ha='center', va='center', color='white')
|
||||
|
|
Loading…
Reference in a new issue