s=datetime.datetime.now().strftime("%d"),
         color="white",
         fontsize=8,
         ha="center",
         va="center",
         bbox=dict(boxstyle='round,pad=0.1',
                   facecolor='red',
                   alpha=1,
                   edgecolor='red'),
         zorder=10)
plt.axvline(dateCache.today(), color='red', linewidth=0.5)

for event in events:
    if 'testsloc' in event and dateCache.parse(
            event['testsloc'][0]) > date_range[0]:
        anotate(ax1, totaaltests['x'], totaaltests['y'], event['date'],
                event['event'], event['testsloc'][0], event['testsloc'][1])

ax1.set_xlabel("Datum")
ax1.set_ylabel("Aantal positief")
ax2.set_ylabel("Percentage positief getest")

ax1.set_ylim([0, 160000])
ax1.set_yticks([20000, 40000, 60000, 80000, 100000, 120000, 140000, 160000])
ax1.set_yticklabels(
    ['20k', '40k', '60k', '80k', '100k', '120k', '140k', '160k'])

ax2.set_ylim([0, 80])

plt.gca().set_xlim([date_range[0], date_range[-1]])

gegenereerd_op = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
ax1.plot(rijden['x'],
         rijden['y'],
         color='coral',
         label='Rijden (Apple, gemiddeld)')
ax1.plot(ov['x'], ov['y'], color='lightgreen', label='OV (Apple, gemiddeld)')
ax1.plot(lopen['x'],
         lopen['y'],
         color='slateblue',
         label='Lopen (Apple, gemiddeld)')

for event in events:
    if 'mobiliteit' in event\
        and dateCache.parse(event['mobiliteit'][0]) > date_range[0]\
        and (len(event['mobiliteit']) <= 2 or len(date_range) <= event['mobiliteit'][2]):
        anotate(ax1, rijden['x'], rijden['y'], event['date'], event['event'],
                event['mobiliteit'][0], event['mobiliteit'][1])

# Put vertical line at current day
plt.text(x=dateCache.today(),
         y=0,
         s=datetime.datetime.now().strftime("%d"),
         color="white",
         fontsize=8,
         ha="center",
         va="center",
         bbox=dict(boxstyle='round,pad=0.1',
                   facecolor='red',
                   alpha=1,
                   edgecolor='red'),
         zorder=10)
plt.axvline(dateCache.today(), color='red', linewidth=0.5)
Example #3
0
    baseline='zero')

totaal_prikken = decimalstring(vaccins_delta['totaal'][-1])

ax1.plot(vaccins_delta['x'],
         vaccins_delta['totaal'],
         color='black',
         label='Totaal per dag (nu: %s)' % totaal_prikken)

graphname = 'vaccins'
for event in events:
    if graphname in event \
        and dateCache.parse(event[graphname][0]) > date_range[0]\
        and (len(event[graphname]) <= 2 or len(date_range) <= event[graphname][2]):
        anotate(ax1, vaccins_delta['x'], vaccins_delta['totaal'],
                event['date'], event['event'], event[graphname][0],
                event[graphname][1])

# Put vertical line at current day
plt.text(x=dateCache.today(),
         y=0,
         s=datetime.now().strftime("%d"),
         color="white",
         fontsize=8,
         ha="center",
         va="center",
         bbox=dict(boxstyle='round,pad=0.1',
                   facecolor='red',
                   alpha=1,
                   edgecolor='red'),
         zorder=10)
Example #4
0
        geschat_ziek_rna['x'].append(dateCache.parse(datum))
        geschat_ziek_rna['y'].append(nieuw_y)

print('Generating daily positive tests graph...')

fig, ax1 = plt.subplots(figsize=(10, 5))
fig.subplots_adjust(top=0.92, bottom=0.13, left=0.09, right=0.91)

ax2 = plt.twinx()

for event in events:
    if graphname in event \
        and dateCache.parse(event[graphname][0]) > date_range[0]\
        and (len(event[graphname]) <= 2 or len(date_range) <= event[graphname][2]):
        anotate(ax2, geschat_ziek_rna['x'], geschat_ziek_rna['y'],
                event['date'], event['event'], event[graphname][0],
                event[graphname][1])

#plt.figure(figsize =(10,5))
ax1.grid(which='both',
         axis='both',
         linestyle='-.',
         color='gray',
         linewidth=1,
         alpha=0.3)
ax2.grid(which='both',
         axis='both',
         linestyle='-.',
         color='gray',
         linewidth=1,
         alpha=0.3)
Example #5
0
)

averages.legend(loc="upper right")

graphname='heatmap'
for event in events:
    if graphname in event \
        and dateCache.parse(event[graphname][0]) > date_range[0]\
        and (len(event[graphname]) <= 2 or len(date_range) <= event[graphname][2]):

        eventDateIndex = (dateCache.parse(event['date']) - startdate).days
        textboxIndex =  (dateCache.parse(event[graphname][0]) - startdate).days
        anotate(
            averages, 
            leeftijdx, gemiddeldeleeftijd['y'],
            eventDateIndex, event['event'], 
            textboxIndex, 
            event[graphname][1]
        )

heatmap.set(
    xlim=[x[0], x[-1]+7],
    xbound=([x[0], x[-1]+7]),
    ylim=[0, 100],
    autoscale_on=False
)
averages.set(
    xlim=([x[0], x[-1]+7]),
    xbound=([x[0], x[-1]+7]),
    ylim=[0, 100],
    autoscale_on=False