Skip to content

Commit 38ceeb1

Browse files
authored
Merge pull request #120 from DE-RSE/handle-todos
Handle todos
2 parents 3688122 + 110f52d commit 38ceeb1

File tree

5 files changed

+96
-83
lines changed

5 files changed

+96
-83
lines changed

.github/workflows/paper.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
- name: Install Python requirements
2121
run: pip install -r requirements.txt
2222

23+
- name: Install LaTeX requirements for matplotlib
24+
run: sudo apt install -y texlive-latex-base texlive-latex-extra cm-super-minimal texlive-fonts-extra
25+
2326
- name: Create contributor snippet
2427
run: python contributors.py
2528

@@ -29,8 +32,10 @@ jobs:
2932
- uses: xu-cheng/latex-action@v3
3033
with:
3134
root_file: paper.tex
35+
3236
- name: move
3337
run: mkdir -p github_artifacts && mv ${{ env.DIR }}/*.pdf ./github_artifacts/
38+
3439
- name: Upload pdf as artifact
3540
uses: actions/upload-artifact@v4
3641
with:

group_composition_plot/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
**/*.pdf
2+
group_composition_plot_the_fantastic_four.labels
23
/submissions.volume

group_composition_plot/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ all: group_composition_plot_the_fantastic_four.pdf \
88
group_composition_plot_the_fantastic_four.pdf: submissions/2023-12-06/Friedrich_Schiller_University_Jena_2023-12-06_10-43-44.json \
99
submissions/2023-12-06/Scientific_Software_Center_2023-12-21_13-13-27.json \
1010
submissions/2023-12-06/University_of_Reading_2023-12-11_10-18-14.json \
11-
submissions/2023-12-06/Princeton_University_2023-11-29_18-33-21.json
12-
./group_composition_plot.py --legend --outfile $@ $^
11+
submissions/2023-12-06/Princeton_University_2023-11-29_18-33-21.json \
12+
group_composition_plot.py
13+
./group_composition_plot.py --legend --outfile $@ $(filter %.json,$^)
1314

1415
group_composition_plot_all.pdf: $(GOOD)
1516
./group_composition_plot.py --legend --outfile $@ $^

group_composition_plot/group_composition_plot.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
#!/usr/bin/env python3
22
import sys, argparse
3+
import matplotlib
4+
rc_params = {'text.usetex': True,
5+
'svg.fonttype': 'none',
6+
'text.latex.preamble': r'\usepackage{libertine}',
7+
'font.size': 14,
8+
'font.family': 'Linux Libertine',
9+
'mathtext.fontset': 'custom',
10+
'mathtext.rm': 'libertine',
11+
'mathtext.it': 'libertine:italic',
12+
'mathtext.bf': 'libertine:bold'
13+
}
14+
matplotlib.rcParams.update(rc_params)
315
import matplotlib.pyplot as plt
416
import json
517
from pprint import pprint
618

19+
720
def errorexit(msg='internal error', code=1):
821
print(msg, file=sys.stderr)
922
sys.exit(code)
@@ -42,25 +55,36 @@ def errorexit(msg='internal error', code=1):
4255
activity_to_color = {activity: colors[i] for i, activity in enumerate(activity_names)}
4356

4457
# Creating the joint plot
45-
scaling = .9
58+
scaling = 6
4659
iymax = (len(data)+1)//2
47-
fig = plt.figure(figsize=(scaling*16, scaling*9/2*iymax))
60+
fig = plt.figure(figsize=(scaling, scaling/2*iymax))
4861

4962
i = 1
63+
inst_names = {}
5064
for inst, idata in data.items():
5165
ax = fig.add_subplot(iymax, min(2, len(data)), i)
52-
ax.pie(idata['activity_weights'], colors=colors, startangle=140, shadow=True, radius=.8)
66+
ax.pie(idata['activity_weights'], colors=colors, startangle=90, shadow=True, radius=1)
5367
inst_name = idata['institution_name']
5468
if 'group_name' in idata:
55-
inst_name = idata['group_name'] + "\n" + inst_name
69+
inst_name = idata['group_name'] + ", " + inst_name
5670
if not args['hide_titles']:
57-
ax.set_title(inst_name, fontsize=20, y=-0.05)
71+
ax.set_title(chr(ord('a')-1+i), y=-0.05)
72+
inst_names[chr(ord('a')-1+i)] = inst_name
5873
i += 1
5974

6075
# Shared legend
6176
if args['legend']:
62-
fig.legend(activity_names, title="Activities", loc="center right", bbox_to_anchor=(1.2, 0.5), fontsize=20)
77+
legend = fig.legend(activity_names, title="Activities",
78+
loc="upper right", bbox_to_anchor=(1.4, .7), frameon=False)
79+
#nothing = matplotlib.patches.Rectangle((0,0), 1, 1, fill=False, edgecolor='none', visible=False)
80+
#legend_inst = plt.legend([nothing]*len(inst_names),
81+
# [i+": "+inst_name for i, inst_name in inst_names.items()],
82+
# loc="upper left", bbox_to_anchor=(-1.2, 0.0), frameon=False)
83+
#plt.gca().add_artist(legend_inst)
84+
with open(args['outfile'].replace('.pdf', '.labels'), 'w') as f:
85+
f.write(', '.join([i+": "+inst_name for i, inst_name in inst_names.items()]))
6386

6487
plt.tight_layout()
88+
fig.subplots_adjust(bottom=0)
6589
fig.savefig(args['outfile'], bbox_inches='tight')
6690
# plt.show()

0 commit comments

Comments
 (0)