From bb70ebbe24b33e52f1b03eeb320c512231753534 Mon Sep 17 00:00:00 2001 From: ftong <95+ftong@noreply.example.org> Date: Tue, 23 Jun 2026 14:33:55 +0200 Subject: [PATCH] Update src/seismic_hazard_forecasting.py stretch image to exact borders of svg file --- src/seismic_hazard_forecasting.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index 1385f43..4b768fb 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -869,8 +869,6 @@ verbose: {verbose}") north, south = grid_lat_max, grid_lat_min # Latitude range east, west = grid_lon_max, grid_lon_min # Longitude range bounds = [[south, west], [north, east]] - - logger.debug(f"Grid extent North {north}, South {south}, East {east}, West {west}") map_center = [np.mean([north, south]), np.mean([east, west])] @@ -878,13 +876,14 @@ verbose: {verbose}") cmap_name = 'YlOrRd' cmap = plt.get_cmap(cmap_name) fig, ax = plt.subplots(figsize=(6, 6)) - ax.imshow(iml_grid_hd, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax, interpolation='bilinear') + fig.add_axes([0, 0, 1, 1]) + ax.imshow(iml_grid_hd, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax, interpolation='bilinear', aspect='auto') ax.axis('off') # Save the figure fig.canvas.draw() overlay_filename = f"overlay_{j}.svg" - plt.savefig(overlay_filename, bbox_inches="tight", pad_inches=0, transparent=True) + plt.savefig(overlay_filename, pad_inches=0, transparent=True) plt.close(fig) # Embed geographic bounding box into the SVG