Skip to content

Commit b3c9ae2

Browse files
committed
Include multi-version plotting
1 parent 5029346 commit b3c9ae2

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

examples/Backtesting/botorch_analytical.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313

1414
#### Necessary imports for this example
1515

16+
import json
1617
import os
18+
import sys
19+
from pathlib import Path
1720

1821
import matplotlib.pyplot as plt
1922
import numpy as np
@@ -126,7 +129,15 @@
126129
n_mc_iterations=N_MC_ITERATIONS,
127130
)
128131

129-
# The following lines plot the results and save the plot in run_analytical.png
130-
sns.lineplot(data=results, x="Num_Experiments", y="Target_CumBest", hue="Scenario")
131-
plt.gcf().set_size_inches(24, 8)
132-
plt.savefig("./run_analytical.png")
132+
themes = json.load(open("plotting_themes.json"))
133+
for theme in themes:
134+
sns.set_theme(style="ticks", font_scale=1.75, rc=themes[theme])
135+
sns.lineplot(data=results, x="Num_Experiments", y="Target_CumBest", hue="Scenario")
136+
plt.savefig(
137+
Path(sys.path[0], f"botorch_analytical_{theme}.svg"),
138+
format="svg",
139+
transparent=True,
140+
)
141+
if theme == "check":
142+
plt.show()
143+
plt.clf()

0 commit comments

Comments
 (0)