# HG changeset patch # User Feng Shu # Date 1687306234 -28800 # Wed Jun 21 08:10:34 2023 +0800 # Node ID 6ddc8ee69a96bb0a27281ad8030e98329a82b78f # Parent 3e3c475270c335d560b557240f8021979dbff1ed Do not set titles in epidemics_report.py Setting titles in the template file is more flexible, and there is no problem of fonts not being displayed, and title can be translate. If Matplotlib encounters non English, such as CJK, it will display tofu blocks because the font cannot be found. message. Lines beginning with 'HG:' are removed. HG: -- HG: user: Feng Shu HG: root: /home/feng/projects/health/ HG: branch: default HG: committing tryton/health_reporting/report/epidemics_report.py HG: Press C-c C-c when you are done editing. diff -r 3e3c475270c3 -r 6ddc8ee69a96 tryton/health_reporting/report/epidemics_report.py --- a/tryton/health_reporting/report/epidemics_report.py Wed Jun 21 08:02:51 2023 +0800 +++ b/tryton/health_reporting/report/epidemics_report.py Wed Jun 21 08:10:34 2023 +0800 @@ -208,8 +208,6 @@ fig = plt.figure(figsize=(6, 3)) cases_by_day = fig.add_subplot(1, 1, 1) - title = 'New cases by day: ' + hc.rec_name - cases_by_day.set_title(title) cases_by_day.bar(days, cases_day) cases_by_day.yaxis.set_major_locator(MaxNLocator(integer=True)) fig.autofmt_xdate() @@ -238,10 +236,8 @@ # Death certificates as an underlying cause certs_uc_day.append(day['certs_day_uc']) - title = "New deaths by day: " + hc.rec_name fig = plt.figure(figsize=(6, 3)) deaths_by_day = fig.add_subplot(1, 1, 1) - deaths_by_day.set_title(title) deaths_by_day.plot(days, certs_ic_day, label="immediate cause") deaths_by_day.plot(days, certs_uc_day, label="underlying condition") deaths_by_day.yaxis.set_major_locator(MaxNLocator(integer=True)) @@ -264,10 +260,8 @@ # Remove ethnicities with zero cases from the plot del(ethnic_count[k]) - title = "Cases by ethnic group: " + hc.rec_name fig = plt.figure(figsize=(6, 3)) cases_by_ethnicity = fig.add_subplot(1, 1, 1) - cases_by_ethnicity.set_title(title) cases_by_ethnicity.pie(ethnic_count.values(), autopct='%1.1f%%', labels=ethnic_count.keys()) @@ -299,10 +293,8 @@ # Remove socioeconomic groups with zero cases from the plot del(ses_count[k]) - title = "Cases by Socioeconomic groups: " + hc.rec_name fig = plt.figure(figsize=(6, 3)) cases_by_socioeconomics = fig.add_subplot(1, 1, 1) - cases_by_socioeconomics.set_title(title) cases_by_socioeconomics.pie(ses_count.values(), autopct='%1,1f%%', labels=ses_count.keys())