Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions simba/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -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()


Expand All @@ -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 = [
Expand Down Expand Up @@ -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:
Expand All @@ -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)


Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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()