give float boundaries instead of ints for small countries
This commit is contained in:
@@ -61,7 +61,12 @@ def plot(data, countries, pop):
|
||||
if actual_level > warn_thresh:
|
||||
infection_level_indicator = "r"
|
||||
bounds = ax1.axis()
|
||||
#if warn_thresh < bounds[3]:
|
||||
# for small population numbers, give floats instead of ints
|
||||
if pop[loc]['pop'] < 5e6:
|
||||
ax1.plot([bounds[0], bounds[1]], [warn_thresh]*2, color="red", linestyle=":", label=f"500 new cases / week / 1M inh.: {warn_thresh:1.2f}".replace(",", "."))
|
||||
ax1.plot([bounds[0], bounds[1]], [info_thresh]*2, color="peru", linestyle=":", label=f"50 new cases / week / 1M inh.: {info_thresh:1.2f}".replace(",", "."))
|
||||
ax1.plot([bounds[0], bounds[1]], [low_thresh]*2, color="gold", linestyle=":", label=f"5 new cases / week / 1M inh.: {low_thresh:1.2f}".replace(",", "."))
|
||||
else: # but not for big populations
|
||||
ax1.plot([bounds[0], bounds[1]], [warn_thresh]*2, color="red", linestyle=":", label=f"500 new cases / week / 1M inh.: {int(warn_thresh):,}".replace(",", "."))
|
||||
ax1.plot([bounds[0], bounds[1]], [info_thresh]*2, color="peru", linestyle=":", label=f"50 new cases / week / 1M inh.: {int(info_thresh):,}".replace(",", "."))
|
||||
ax1.plot([bounds[0], bounds[1]], [low_thresh]*2, color="gold", linestyle=":", label=f"5 new cases / week / 1M inh.: {int(low_thresh):,}".replace(",", "."))
|
||||
|
||||
Reference in New Issue
Block a user