Skip to content

Commit

Permalink
improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
barneydobson committed Oct 22, 2024
1 parent 3581124 commit 0f06f94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/swmmanywhere/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,21 @@ def plot_clickable(model_dir: Path):

# Add edges
for edge, row in edges.iterrows():
# Create a plot for each edge
grp = flows.get_group(str(edge))
f, ax = plt.subplots(figsize=(4, 3))
grp.set_index("date").value.plot(ylabel="flow (l/s)", title=edge, ax=ax)
img = BytesIO()
f.tight_layout()
f.savefig(img, format="png", dpi=94)
plt.close(f)

# Convert plot to base64
img.seek(0)
img_base64 = base64.b64encode(img.read()).decode()
img_html = f'<img src="data:image/png;base64,{img_base64}">'

# Add edge to map
folium.PolyLine(
[[c[1], c[0]] for c in row.geometry.coords],
color="black",
Expand Down

0 comments on commit 0f06f94

Please sign in to comment.