Skip to content

Commit

Permalink
Plot composite charts (issue #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickynicolson committed Nov 26, 2022
1 parent e7ce860 commit 9061917
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,31 @@ findability_level_2: data/findability-wcvp-map-level-2.png
findability_level_3: data/findability-wcvp-map-level-3.png
findability_all: data/findability-wcvp-map-level-1.png data/findability-wcvp-map-level-2.png data/findability-wcvp-map-level-3.png

# Map WCVP data: composites
data/wcvp-map-composite-level-%.png: plotoageo.py data/ipniname-oastatus-wcvp-report-%.csv downloads/level%.geojson
$(python_launch_cmd) $^ $(limit_args) --tdwg_wgsrpd_level=$* --plot-maps --plot-composite --outputfile-composite=$@ data/oaratio-wcvp-map-level-$*.png data/findability-wcvp-map-level-$*.png
# Shorthand:
composite_level_1: data/wcvp-map-composite-level-1.png
composite_level_2: data/wcvp-map-composite-level-2.png
composite_level_3: data/wcvp-map-composite-level-3.png
composite_all: data/wcvp-map-composite-level-1.png data/wcvp-map-composite-level-2.png data/wcvp-map-composite-level-3.png

###############################################################################

oatrends_charts_year:=data/ipni-oatrend-year.png
oastatus_charts_year:= data/ipni-oastatustrendpc.png
oatrends_charts_publ:=data/ipni-oatrend-publ.png

findability_charts:= data/findability-wcvp-map-level-1.png data/findability-wcvp-map-level-2.png data/findability-wcvp-map-level-3.png
composite_charts:=data/wcvp-map-composite-level-1.png data/wcvp-map-composite-level-2.png data/wcvp-map-composite-level-3.png

oa_charts: data/oaratio-wcvp-map-level-1.png data/oaratio-wcvp-map-level-2.png data/oaratio-wcvp-map-level-3.png

all: $(findability_charts) $(oaratio_charts)
all: $(findability_charts) $(oaratio_charts) $(composite_charts)

data_archive_zip:=$(shell basename $(CURDIR))-data.zip

archive: $(findability_charts) $(oaratio_charts)
archive: $(findability_charts) $(oaratio_charts) $(composite_charts)
mkdir -p archive
echo "Archived on $(date_formatted)" >> data/archive-info.txt
zip archive/$(data_archive_zip) data/archive-info.txt data/* -r
Expand Down
24 changes: 24 additions & 0 deletions plotoageo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def main():
parser.add_argument("--tdwg_wgsrpd_level", default=2, type=int)
parser.add_argument("--tax_novs_only", action='store_true')
parser.add_argument('--plot-maps', action='store_true')
parser.add_argument('--plot-composite', action='store_true')
parser.add_argument('--outputfile_composite', default=None)
parser.add_argument('-d','--delimiter', type=str, default='\t')
parser.add_argument('--year_min',default=2012)
parser.add_argument('--year_max',default=2021)
Expand Down Expand Up @@ -99,5 +101,27 @@ def main():
fig.tight_layout(pad=0)
plt.savefig(args.outputfile_unknown, bbox_inches='tight',pad_inches = 0.1, dpi = 400)

# 3.3 plot composite if required
if args.plot_composite:
fig, ax = plt.subplots(2, 1)
# Repeat of above - TODO extract to reusable method
world.plot(column='OA_unfind',ax=ax[0], legend=True, legend_kwds=dict(loc='lower left',fontsize='x-small'), cmap='OrRd', scheme='quantiles')
ax[0].set_title("Proportion of un-discoverable publications of {} IPNI nomenclatural acts ({}-{})".format(coverage,args.year_min,args.year_max))
ax[0].xaxis.set_visible(False)
ax[0].yaxis.set_visible(False)

# Repeat of above - TODO extract to reusable method
world.plot(column='OA_ratio',ax=ax[1], legend=True, legend_kwds=dict(loc='lower left',fontsize='x-small'), cmap='OrRd', scheme='quantiles')
coverage = 'all'
if args.tax_novs_only:
coverage = 'tax. nov.'
ax[1].set_title("Ratio of open:closed access of {} IPNI nomenclatural acts ({}-{})".format(coverage,args.year_min,args.year_max))
ax[1].xaxis.set_visible(False)
ax[1].yaxis.set_visible(False)

fig.tight_layout(pad=0)
plt.savefig(args.outputfile_composite, bbox_inches='tight',pad_inches = 0.1, dpi = 400)


if __name__ == "__main__":
main()

0 comments on commit 9061917

Please sign in to comment.