Skip to content

Commit

Permalink
(fix) gracefully handle empty diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavnatarajan committed Sep 11, 2024
1 parent 955aaf0 commit 0032b00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "chalc"
version = "4.0.0"
version = "4.0.1"
authors = [{ name = "Abhinav Natarajan", email = "[email protected]" }]
description = "Persistent homology of chromatic Delaunay filtrations"
readme = { file = "README.md", content-type = "text/markdown" }
Expand Down
4 changes: 3 additions & 1 deletion src/chalc/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import seaborn as sns
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from matplotlib.legend import Legend
from pandas import DataFrame

from chalc.filtration import FilteredComplex
Expand Down Expand Up @@ -206,7 +207,8 @@ def _plot_diagram(
ret_ax.set(ylabel=None)
ret_ax.set(title=title)
ret_ax.set_aspect("equal")
if points_legend:
has_legend = any(True for c in ret_ax.get_children() if isinstance(c, Legend))
if points_legend and has_legend:
sns.move_legend(ret_ax, "lower right")
handle = ax if ax is not None else plt
handle.plot([0, inf_level], [0, inf_level], "k-", alpha=0.4)
Expand Down

0 comments on commit 0032b00

Please sign in to comment.