1
0
Fork 0

feat: Make Plots as PDF and PNG

This commit is contained in:
Benedikt Bastin 2021-01-16 18:43:19 +01:00
parent 1719780ff7
commit 9e4efd5dc6
1 changed files with 7 additions and 5 deletions

12
plot.py
View File

@ -82,8 +82,8 @@ filename_stand = stand_date.strftime("%Y%m%d%H%M%S")
def plot_extrapolation_portion(percentage):
print_percentage = int(percentage * 100)
plot_filename = '{}/{}_extrapolated_to_{}_percent.pdf'.format(plots_folder, filename_stand, print_percentage)
plot_filename_latest = '{}/latest_extrapolated_to_{}_percent.pdf'.format(plots_folder, print_percentage)
plot_filename = '{}/{}_extrapolated_to_{}_percent'.format(plots_folder, filename_stand, print_percentage)
plot_filename_latest = '{}/latest_extrapolated_to_{}_percent'.format(plots_folder, print_percentage)
if os.path.isfile(plot_filename):
print('Plot {} already exists'.format(plot_filename))
@ -128,11 +128,13 @@ def plot_extrapolation_portion(percentage):
ax2.set_ylabel('Kumulierte Impfungen')
plt.savefig(plot_filename)
plt.savefig(plot_filename_latest)
plt.savefig(plot_filename + '.pdf')
plt.savefig(plot_filename + '.png')
plt.savefig(plot_filename_latest + '.pdf')
plt.savefig(plot_filename_latest + '.png')
plt.close()
print('Created plot {}'.format(plot_filename))
print('Created plot {} as pdf and png'.format(plot_filename))
plot_extrapolation_portion(0.1)