Skip to content

Commit

Permalink
Merge pull request #7 from ror-community/chart-color
Browse files Browse the repository at this point in the history
Using separate color schemes for left and right charts
  • Loading branch information
adambuttrick authored Oct 2, 2023
2 parents 4aa41c1 + 266db4d commit da30309
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Binary file modified data/crossref_overlap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/datacite_overlap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions utilities/create_aggregate_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,21 @@ def load_datacite():


def save_plot(fig, filename):
fig.savefig(filename, dpi=300)
fig.savefig(filename, dpi=300)


def plot_overlap(overlap_data, data_source):
fig, axs = plt.subplots(1, 2, figsize=(12, 6))
mpl.rcParams['font.size'] = 12
mpl.rcParams['font.weight'] = 'bold'
funder_colors = ['tab:blue', 'tab:orange']
assertion_colors = ['green', 'pink']

axs[0].pie(
[overlap_data['overlapping_funders_percentage'], overlap_data['non_overlapping_funders_percentage']],
labels=['Overlapping', 'Non-overlapping'],
autopct='%1.1f%%'
autopct='%1.1f%%',
colors=funder_colors
)
axs[0].set_title(
f"Overlapping vs Non-overlapping Funder IDs¹\n\n{format(overlap_data['overlapping_funders'], ',d')} / {format(overlap_data['total_funders'], ',d')} total funders",
Expand All @@ -87,7 +90,8 @@ def plot_overlap(overlap_data, data_source):
axs[1].pie(
[overlap_data['overlapping_assertions_percentage'], overlap_data['non_overlapping_assertions_percentage']],
labels=['Overlapping', 'Non-overlapping'],
autopct='%1.1f%%'
autopct='%1.1f%%',
colors=assertion_colors
)
axs[1].set_title(
f"Overlapping vs Non-overlapping Assertions²\n\n{format(overlap_data['overlapping_assertions'], ',d')} / {format(overlap_data['total_assertions'], ',d')} total assertions",
Expand Down
6 changes: 4 additions & 2 deletions views/member_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ def calculate_percentages(overlap, funders, equivalents):
fig, axs = plt.subplots(1, 2, figsize=(12, 6))
mpl.rcParams['font.size'] = 12
mpl.rcParams['font.weight'] = 'bold'
funder_colors = ['tab:blue', 'tab:orange']
assertion_colors = ['green', 'pink']

axs[0].pie([overlapping_funders_percentage, non_overlapping_funders_percentage], labels=[
'Overlapping', 'Non-overlapping'], autopct='%1.1f%%')
'Overlapping', 'Non-overlapping'], autopct='%1.1f%%', colors=funder_colors)
axs[0].set_title(f"Overlapping vs Non-overlapping Funder IDs¹\n\n{format(overlapping_funders, ',d')} / {format(total_funders, ',d')} total funders", fontweight='bold')

axs[1].pie([overlapping_assertions_percentage, non_overlapping_assertions_percentage], labels=[
'Overlapping', 'Non-overlapping'], autopct='%1.1f%%')
'Overlapping', 'Non-overlapping'], autopct='%1.1f%%', colors=assertion_colors)
axs[1].set_title(f"Overlapping vs Non-overlapping Assertions²\n\n{format(overlapping_assertions, ',d')} / {format(total_assertions, ',d')} total assertions", fontweight='bold')

plt.tight_layout()
Expand Down

0 comments on commit da30309

Please sign in to comment.