Update src/seismic_hazard_forecasting.py

stretch image to exact borders of svg file
This commit is contained in:
2026-06-23 14:33:55 +02:00
parent 73fd54cc76
commit bb70ebbe24
+3 -4
View File
@@ -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