Compare commits
6 Commits
master
...
ISEPOS-237
Author | SHA1 | Date | |
---|---|---|---|
9c58664770 | |||
17cbcc8e79 | |||
cce0cd258d | |||
c20f7c06a7 | |||
22fc9f7c07 | |||
8f1ab5518a |
@ -70,6 +70,8 @@ def main(catalog_file, mc_file, pdf_file, m_file, m_select, mag_label, mc, m_max
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from matplotlib.ticker import MultipleLocator
|
from matplotlib.ticker import MultipleLocator
|
||||||
from matplotlib.contour import ContourSet
|
from matplotlib.contour import ContourSet
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
import json
|
||||||
|
|
||||||
logger = getDefaultLogger('igfash')
|
logger = getDefaultLogger('igfash')
|
||||||
|
|
||||||
@ -495,9 +497,18 @@ verbose: {verbose}")
|
|||||||
|
|
||||||
# Save the figure
|
# Save the figure
|
||||||
fig.canvas.draw()
|
fig.canvas.draw()
|
||||||
plt.savefig("overlay_" + str(j) + ".svg", bbox_inches="tight", pad_inches=0, transparent=True)
|
overlay_filename = f"overlay_{j}.svg"
|
||||||
|
plt.savefig(overlay_filename, bbox_inches="tight", pad_inches=0, transparent=True)
|
||||||
plt.close(fig)
|
plt.close(fig)
|
||||||
|
|
||||||
|
# Embed geographic bounding box into the SVG
|
||||||
|
map_bounds = dict(zip(("south", "west", "north", "east"),
|
||||||
|
map(float, (lat.min(), lon.min(), lat.max(), lon.max()))))
|
||||||
|
tree = ET.parse(overlay_filename)
|
||||||
|
tree.getroot().set("data-map-bounds", json.dumps(map_bounds))
|
||||||
|
tree.write(overlay_filename, encoding="utf-8", xml_declaration=True)
|
||||||
|
logger.info(f"Saved geographic bounds to SVG metadata (data-map-bounds): {overlay_filename} → {map_bounds}")
|
||||||
|
|
||||||
# Make the color bar
|
# Make the color bar
|
||||||
cmap_name = 'viridis'
|
cmap_name = 'viridis'
|
||||||
width = 50
|
width = 50
|
||||||
|
Loading…
Reference in New Issue
Block a user