added activity in the titles of graphics

This commit is contained in:
Thomas PIQUE 2024-03-28 09:27:29 +00:00
parent 10824e5e24
commit f0f69d710a
3 changed files with 252 additions and 262 deletions

View File

@ -76,7 +76,7 @@ X_test_business_fig = df_business_fig(X_test_segment, "segment", business_var)
# save histogram to Minio # save histogram to Minio
hist_segment_business_KPIs(X_test_business_fig, "segment", "size", "nb_tickets", hist_segment_business_KPIs(X_test_business_fig, "segment", "size", "nb_tickets",
"nb_purchases", "total_amount", "nb_campaigns") "nb_purchases", "total_amount", "nb_campaigns")
save_file_s3_mp(File_name = "segments_business_KPIs_", type_of_activity = type_of_activity) save_file_s3_mp(File_name = "segments_business_KPI_", type_of_activity = type_of_activity)
### 2. description of marketing personae (spider chart) ### 2. description of marketing personae (spider chart)

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@ def load_test_file(type_of_activity):
def save_file_s3_mp(File_name, type_of_activity): def save_file_s3_mp(File_name, type_of_activity):
image_buffer = io.BytesIO() image_buffer = io.BytesIO()
plt.savefig(image_buffer, format='png') plt.savefig(image_buffer, format='png', dpi=110)
image_buffer.seek(0) image_buffer.seek(0)
PATH = f"projet-bdc2324-team1/Output_marketing_personae_analysis/{type_of_activity}/" PATH = f"projet-bdc2324-team1/Output_marketing_personae_analysis/{type_of_activity}/"
FILE_PATH_OUT_S3 = PATH + File_name + type_of_activity + '.png' FILE_PATH_OUT_S3 = PATH + File_name + type_of_activity + '.png'
@ -75,7 +75,7 @@ def hist_segment_business_KPIs(df, segment, size, nb_tickets, nb_purchases, tota
plt.legend(title = "segment", loc = "upper right", bbox_to_anchor=(1.2, 1)) plt.legend(title = "segment", loc = "upper right", bbox_to_anchor=(1.2, 1))
plt.ylabel("Fraction represented by the segment (%)") plt.ylabel("Fraction represented by the segment (%)")
plt.title("Relative weight of each segment regarding business KPIs") plt.title(f"Relative weight of each segment regarding business KPIs\nfor {type_of_activity} companies", size=12)
# plt.show() # plt.show()
@ -196,8 +196,9 @@ def radar_mp_plot_all(df, categories) :
ax[row, col].spines['polar'].set_visible(False) ax[row, col].spines['polar'].set_visible(False)
ax[row, col].set_title(f'Characteristics of the segment {index+1}\n', size = 24) ax[row, col].set_title(f'Segment {index+1}\n', size = 24)
fig.suptitle(f"Characteristics of marketing personae of {type_of_activity} companies", size=32)
# plt.show() # plt.show()