Skip to content

Commit e4a22b1

Browse files
committed
disable interactive mode in final plotting script
1 parent 653fd49 commit e4a22b1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

scripts/pypsa-de/plot_ariadne_scenario_comparison.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
22

3+
import matplotlib
4+
5+
matplotlib.use("Agg") # Use a non-interactive backend
36
import matplotlib.pyplot as plt
47
import pandas as pd
58

@@ -12,10 +15,10 @@ def scenario_plot(df, var):
1215
unit = "billion EUR2020/yr"
1316
df = df.droplevel("Unit")
1417
ax = df.T.plot(xlabel="years", ylabel=str(unit), title=str(var))
15-
plt.close()
1618
prefix = snakemake.config["run"]["prefix"]
1719
var = var.replace("|", "-").replace("\\", "-").replace(" ", "-").replace("/", "-")
1820
ax.figure.savefig(f"results/{prefix}/ariadne_comparison/{var}", bbox_inches="tight")
21+
plt.close(ax.figure)
1922

2023

2124
if __name__ == "__main__":
@@ -46,5 +49,3 @@ def scenario_plot(df, var):
4649

4750
for var in df._get_label_or_level_values("Variable"):
4851
scenario_plot(df.xs(var, level="Variable"), var)
49-
50-
var = "Price|Carbon"

0 commit comments

Comments
 (0)