From 83ba60e3048a46b4942482619f5c0a4d77dc8617 Mon Sep 17 00:00:00 2001 From: Julian Brendel Date: Fri, 16 Jan 2026 11:38:22 +0100 Subject: [PATCH] safe all figs as png and pdf --- simba/report.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/simba/report.py b/simba/report.py index 0fa64f8..721a61e 100644 --- a/simba/report.py +++ b/simba/report.py @@ -478,6 +478,7 @@ def plot_distance_per_rotation_distribution(extended_plots_path, schedule): ax.legend() plt.tight_layout() plt.savefig(extended_plots_path / "distribution_distance.png", dpi=DPI) + plt.savefig(extended_plots_path / "distribution_distance.pdf") plt.close() @@ -507,7 +508,8 @@ def plot_consumption_per_rotation_distribution(extended_plots_path, schedule): ax.set_title('Distribution of energy consumption of rotations per vehicle type') ax.legend() plt.tight_layout() - plt.savefig(extended_plots_path / "distribution_consumption", dpi=DPI) + plt.savefig(extended_plots_path / "distribution_consumption.png", dpi=DPI) + plt.savefig(extended_plots_path / "distribution_consumption.pdf") plt.close() @@ -562,7 +564,8 @@ def plot_charge_type_distribution(extended_plots_path, scenario, schedule): ax.yaxis.get_major_locator().set_params(integer=True) ax.legend(["successful rotations", "negative rotations"]) ax.set_title("Feasibility of rotations per charging type") - plt.savefig(extended_plots_path / "charge_types", dpi=DPI) + plt.savefig(extended_plots_path / "charge_types.png", dpi=DPI) + plt.savefig(extended_plots_path / "charge_types.pdf") plt.close() @@ -579,8 +582,8 @@ def plot_gc_power_timeseries(extended_plots_path, scenario, schedule, args): :type args: argparse.Namespace """ for gcID, gc in scenario.components.grid_connectors.items(): - fig, ax = plt.subplots() - # fig, ax = plt.subplots(figsize=(9, 4.8)) # For legends outside plot + # fig, ax = plt.subplots() + fig, ax = plt.subplots(figsize=(9, 4.8)) # For legends outside plot agg_ts = aggregate_timeseries(scenario, gcID) headers = [ @@ -704,8 +707,8 @@ def plot_gc_power_timeseries(extended_plots_path, scenario, schedule, args): label=label, facecolor=color, alpha=0.2) start_idx = i - ax.legend() - # ax.legend(loc='center left', bbox_to_anchor=(1.2, 0.5)) # legend outside of plot + # ax.legend() + ax.legend(loc='center left', bbox_to_anchor=(1.2, 0.5)) # legend outside of plot # legend might be behind twin plots, so adjust z-order # since this affects visibility, hide original axis frame if has_battery_column: @@ -727,6 +730,7 @@ def plot_gc_power_timeseries(extended_plots_path, scenario, schedule, args): ax.tick_params(axis='x', rotation=30) plt.tight_layout() plt.savefig(extended_plots_path / f"{sanitize(gcID)}_power_overview.png", dpi=DPI) + plt.savefig(extended_plots_path / f"{sanitize(gcID)}_power_overview.pdf") plt.close(fig) @@ -801,8 +805,8 @@ def VehicleIdRowGenerator(): ncol=len(handles)//2+1, prop={"size": 7}) fig.tight_layout() # PDF so Block names stay readable - fig.savefig(output_path_folder / f"{sanitize(depot)}_vehicle_services.pdf") fig.savefig(output_path_folder / f"{sanitize(depot)}_vehicle_services.png", dpi=DPI) + fig.savefig(output_path_folder / f"{sanitize(depot)}_vehicle_services.pdf") plt.close(fig) @@ -862,8 +866,8 @@ def DenseRowGenerator(): fig.tight_layout() # PDF so Block names stay readable - fig.savefig(output_path_folder / f"{sanitize(depot)}_block_distribution.pdf") fig.savefig(output_path_folder / f"{sanitize(depot)}_block_distribution.png", dpi=DPI) + fig.savefig(output_path_folder / f"{sanitize(depot)}_block_distribution.pdf") plt.close(fig) @@ -927,5 +931,6 @@ def plot_active_rotations(extended_plots_path, scenario, schedule): plt.grid(axis="y") plt.title("Active Rotations") plt.tight_layout() - plt.savefig(extended_plots_path / "active_rotations", dpi=DPI) + plt.savefig(extended_plots_path / "active_rotations.png", dpi=DPI) + plt.savefig(extended_plots_path / "active_rotations.pdf") plt.close()