|
| 1 | +import matplotlib.pyplot as plt |
| 2 | +import json |
| 3 | + |
| 4 | +def read_data(filename): |
| 5 | + with open(filename) as f: |
| 6 | + data = json.load(f) |
| 7 | + return data["activity_weights"] |
| 8 | + |
| 9 | +# Read data |
| 10 | +princeton = read_data("./submissions/2023-12-06_submissions/Princeton_University_2023-11-29_18-33-21.json") |
| 11 | +reading = read_data("./submissions/2023-12-06_submissions/University_of_Reading_2023-12-11_10-18-14.json") |
| 12 | +heidelberg = read_data("./submissions/2023-12-06_submissions/Scientific_Software_Center_2023-12-21_13-13-27.json") |
| 13 | +jena = read_data("./submissions/2023-12-06_submissions/Friedrich_Schiller_University_Jena_2023-12-06_10-43-44.json") |
| 14 | + |
| 15 | +activities = [ |
| 16 | + "RSE Network", |
| 17 | + "Partner Network", |
| 18 | + "RSE Teaching", |
| 19 | + "RSE Consultation", |
| 20 | + "SW Development", |
| 21 | + "SW Maintenance", |
| 22 | + "RSE Infrastructure", |
| 23 | + "RSE Research", |
| 24 | + "RSE Outreach" |
| 25 | + ] |
| 26 | +colors = plt.cm.Paired(range(len(activities))) |
| 27 | + |
| 28 | +# Mapping activities to colors |
| 29 | +activity_to_color = {activity: colors[i] for i, activity in enumerate(activities)} |
| 30 | + |
| 31 | +# Creating the joint plot |
| 32 | +fig, axs = plt.subplots(2, 2, figsize=(16, 16)) |
| 33 | + |
| 34 | +# Plot for Jena |
| 35 | +axs[0, 0].pie(jena, colors=colors, startangle=140) |
| 36 | +axs[0, 0].set_title('Kompetenzzentrum Digitale Forschung\n Friedrich Schiller University Jena', fontsize=20) |
| 37 | + |
| 38 | +# Plot for Heidelberg |
| 39 | +axs[0, 1].pie(heidelberg, colors=colors, startangle=140) |
| 40 | +axs[0, 1].set_title('Scientific Software Center\n Heidelberg University', fontsize=20) |
| 41 | + |
| 42 | +# Plot for Princeton |
| 43 | +axs[1, 1].pie(princeton, colors=colors, startangle=140) |
| 44 | +axs[1, 1].set_title('Research Software Engineering Group\n Princeton University', fontsize=20) |
| 45 | + |
| 46 | +# Plot for Reading |
| 47 | +axs[1, 0].pie(reading, colors=colors, startangle=140) |
| 48 | +axs[1, 0].set_title('Research Software Engineering\n The University of Reading', fontsize=20) |
| 49 | + |
| 50 | +# Shared legend |
| 51 | +fig.legend(activities, title="Activities", loc="center right", bbox_to_anchor=(1.1, 0.5), fontsize=20) |
| 52 | + |
| 53 | + |
| 54 | +fig.savefig("group_composition_plot.png", dpi=300, bbox_inches='tight') |
| 55 | +# # Adjust layout |
| 56 | +# plt.tight_layout() |
| 57 | +# plt.show() |
0 commit comments