Skip to content

Commit 6ee3749

Browse files
committed
Improve labels
1 parent e77e9f5 commit 6ee3749

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/multi_vector_simulator/utils/analysis.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,16 @@ def postprocessing_kpi(
611611
os.path.join("docs", "MVS_parameters_list.csv"), index_col=6
612612
)
613613
try:
614-
unit = variable_definitions[":Unit:"][variable_name]
614+
unit = + variable_definitions[":Unit:"][variable_name]
615615
except:
616-
unit=""
617-
x_label = f"{variable_name.replace('_', ' ')} of {variable_column.replace('_', ' ')} in {unit}"
616+
unit= ""
617+
618+
619+
x_label = f"{variable_name.replace('_', ' ')}"
620+
if len(variable_column)>1:
621+
x_label += f" of {variable_column.replace('_', ' ')}"
622+
if len(unit)>0:
623+
x_label += f" in {unit}"
618624

619625
kpi_definitions = pd.read_csv(
620626
os.path.join("docs", "MVS_kpis_list.csv"), index_col=0
@@ -630,7 +636,10 @@ def postprocessing_kpi(
630636
plot_data = pd.Series(senstivitiy_data[kpi], index=senstivitiy_data.index)
631637
plot_data.plot()
632638
plt.xlabel(x_label)
633-
plt.ylabel(f"{name} in {unit}")
639+
y_label = name
640+
if len(unit) > 0:
641+
y_label += f" in {unit}"
642+
plt.ylabel(y_label)
634643
plt.savefig(
635644
os.path.join(output_path_summary, f"{variable_name}_effect_on_{kpi}.png")
636645
)

0 commit comments

Comments
 (0)