mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-05 17:11:35 +02:00
spinx going book
This commit is contained in:
@ -0,0 +1,7 @@
|
||||
"""
|
||||
PLotting
|
||||
========
|
||||
|
||||
Todo
|
||||
|
||||
"""
|
@ -13,6 +13,14 @@ MODEL_MAP = None
|
||||
|
||||
|
||||
def compare_seed_runs(run_path: Union[str, PathLike], use_tex: bool = False):
|
||||
"""
|
||||
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
run_path = Path(run_path)
|
||||
df_list = list()
|
||||
for run, monitor_file in enumerate(run_path.rglob('monitor*.pick')):
|
||||
@ -49,6 +57,14 @@ def compare_seed_runs(run_path: Union[str, PathLike], use_tex: bool = False):
|
||||
|
||||
def compare_model_runs(run_path: Path, run_identifier: Union[str, int], parameter: Union[str, List[str]],
|
||||
use_tex: bool = False):
|
||||
"""
|
||||
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
run_path = Path(run_path)
|
||||
df_list = list()
|
||||
parameter = [parameter] if isinstance(parameter, str) else parameter
|
||||
@ -89,6 +105,14 @@ def compare_model_runs(run_path: Path, run_identifier: Union[str, int], paramete
|
||||
|
||||
def compare_all_parameter_runs(run_root_path: Path, parameter: Union[str, List[str]],
|
||||
param_names: Union[List[str], None] = None, str_to_ignore='', use_tex: bool = False):
|
||||
"""
|
||||
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
run_root_path = Path(run_root_path)
|
||||
df_list = list()
|
||||
parameter = [parameter] if isinstance(parameter, str) else parameter
|
||||
|
@ -11,6 +11,14 @@ from marl_factory_grid.utils.plotting.plotting_utils import prepare_plot
|
||||
|
||||
def plot_single_run(run_path: Union[str, PathLike], use_tex: bool = False, column_keys=None,
|
||||
file_key: str ='monitor', file_ext: str ='pkl'):
|
||||
"""
|
||||
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
run_path = Path(run_path)
|
||||
df_list = list()
|
||||
if run_path.is_dir():
|
||||
|
@ -1,7 +1,6 @@
|
||||
import seaborn as sns
|
||||
import matplotlib as mpl
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
PALETTE = 10 * (
|
||||
"#377eb8",
|
||||
"#4daf4a",
|
||||
@ -20,6 +19,14 @@ PALETTE = 10 * (
|
||||
|
||||
|
||||
def plot(filepath, ext='png'):
|
||||
"""
|
||||
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
plt.tight_layout()
|
||||
figure = plt.gcf()
|
||||
ax = plt.gca()
|
||||
@ -35,6 +42,13 @@ def plot(filepath, ext='png'):
|
||||
|
||||
|
||||
def prepare_tex(df, hue, style, hue_order):
|
||||
"""
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
sns.set(rc={'text.usetex': True}, style='whitegrid')
|
||||
lineplot = sns.lineplot(data=df, x='Episode', y='Score', ci=95, palette=PALETTE,
|
||||
hue_order=hue_order, hue=hue, style=style)
|
||||
@ -45,6 +59,13 @@ def prepare_tex(df, hue, style, hue_order):
|
||||
|
||||
|
||||
def prepare_plt(df, hue, style, hue_order):
|
||||
"""
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
print('Struggling to plot Figure using LaTeX - going back to normal.')
|
||||
plt.close('all')
|
||||
sns.set(rc={'text.usetex': False}, style='whitegrid')
|
||||
@ -57,6 +78,13 @@ def prepare_plt(df, hue, style, hue_order):
|
||||
|
||||
|
||||
def prepare_center_double_column_legend(df, hue, style, hue_order):
|
||||
"""
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
print('Struggling to plot Figure using LaTeX - going back to normal.')
|
||||
plt.close('all')
|
||||
sns.set(rc={'text.usetex': False}, style='whitegrid')
|
||||
@ -70,6 +98,13 @@ def prepare_center_double_column_legend(df, hue, style, hue_order):
|
||||
|
||||
|
||||
def prepare_plot(filepath, results_df, ext='png', hue='Measurement', style=None, use_tex=False):
|
||||
"""
|
||||
Todo
|
||||
|
||||
:param filepath:
|
||||
:param ext:
|
||||
:return:
|
||||
"""
|
||||
df = results_df.copy()
|
||||
df[hue] = df[hue].str.replace('_', '-')
|
||||
hue_order = sorted(list(df[hue].unique()))
|
||||
|
Reference in New Issue
Block a user