From 0db78a93e641f0bdccb64bc0ac6bbfba9f010a3e Mon Sep 17 00:00:00 2001 From: Bobby Xiong Date: Tue, 11 Jun 2024 15:10:12 +0200 Subject: [PATCH 1/2] Fixed bug which generated empty pdfs when calling plot_summary from CI or snakemake. Using .svg exports instead. --- rules/postprocess.smk | 6 +++--- scripts/plot_summary.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/postprocess.smk b/rules/postprocess.smk index 39fd46c9d..edeff1ef4 100644 --- a/rules/postprocess.smk +++ b/rules/postprocess.smk @@ -233,9 +233,9 @@ rule plot_summary: eurostat="data/eurostat/Balances-April2023", co2="data/bundle/eea/UNFCCC_v23.csv", output: - costs=RESULTS + "graphs/costs.pdf", - energy=RESULTS + "graphs/energy.pdf", - balances=RESULTS + "graphs/balances-energy.pdf", + costs=RESULTS + "graphs/costs.svg", + energy=RESULTS + "graphs/energy.svg", + balances=RESULTS + "graphs/balances-energy.svg", threads: 2 resources: mem_mb=10000, diff --git a/scripts/plot_summary.py b/scripts/plot_summary.py index 39fbba030..d131e9378 100644 --- a/scripts/plot_summary.py +++ b/scripts/plot_summary.py @@ -353,7 +353,7 @@ def plot_balances(): frameon=False, ) - fig.savefig(snakemake.output.balances[:-10] + k + ".pdf", bbox_inches="tight") + fig.savefig(snakemake.output.balances[:-10] + k + ".svg", bbox_inches="tight") def historical_emissions(countries): @@ -563,7 +563,7 @@ def plot_carbon_budget_distribution(input_eurostat, options): ) plt.grid(axis="y") - path = snakemake.output.balances.split("balances")[0] + "carbon_budget.pdf" + path = snakemake.output.balances.split("balances")[0] + "carbon_budget.svg" plt.savefig(path, bbox_inches="tight") From 1b0ef5ebd57d4b638be6e1ecc516d8c7daef0dc1 Mon Sep 17 00:00:00 2001 From: Bobby Xiong Date: Tue, 11 Jun 2024 15:36:51 +0200 Subject: [PATCH 2/2] Bug fix Snakefile: rule all input updated to 'graphs/costs.svg'. --- Snakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snakefile b/Snakefile index 412d520d7..be2545ada 100644 --- a/Snakefile +++ b/Snakefile @@ -73,7 +73,7 @@ if config["foresight"] == "perfect": rule all: input: - expand(RESULTS + "graphs/costs.pdf", run=config["run"]["name"]), + expand(RESULTS + "graphs/costs.svg", run=config["run"]["name"]), default_target: True