Skip to content

Commit 256bcde

Browse files
committed
make script work for individual (single) groups
1 parent 1306a83 commit 256bcde

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

group_composition_plot/group_composition_plot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ def errorexit(msg='internal error', code=1):
4444
# Creating the joint plot
4545
scaling = .9
4646
iymax = (len(data)+1)//2
47-
fig, axs = plt.subplots(iymax, 2, figsize=(scaling*16, scaling*8*iymax))
47+
fig = plt.figure(figsize=(scaling*16, scaling*8*iymax))
4848

49-
ix = iy = 0
49+
i = 1
5050
for inst, idata in data.items():
51-
axs[iy, ix].pie(idata['activity_weights'], colors=colors, startangle=140)
51+
ax = fig.add_subplot(iymax, min(2, len(data)), i)
52+
ax.pie(idata['activity_weights'], colors=colors, startangle=140)
5253
inst_name = idata['institution_name']
5354
if 'group_name' in idata:
5455
inst_name = idata['group_name'] + "\n" + inst_name
5556
if not args['hide_titles']:
56-
axs[iy, ix].set_title(inst_name, fontsize=20)
57-
iy += ix
58-
ix = 1 if ix == 0 else 0
57+
ax.set_title(inst_name, fontsize=20)
58+
i += 1
5959

6060
# Shared legend
6161
if args['legend']:

0 commit comments

Comments
 (0)