Skip to content

Commit

Permalink
feat: make plot writing to file optional in plot_grounding_rates
Browse files Browse the repository at this point in the history
Make writing plots to file optional in the `plot_grounding_rates`
function by introducing a new parameter to control this behavior. This
allows for flexible usage, including previewing plots without generating
files.
  • Loading branch information
clnsmth authored Dec 20, 2024
1 parent b392629 commit 18d01bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/spinneret/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def get_shared_ontology(set1: list, set2: list) -> Union[str, None]:


def plot_grounding_rates(
grounding_rates: dict, configuration: str, output_file: str
grounding_rates: dict, configuration: str, output_file: str = None
) -> None:
"""
Plot the grounding rates of the test data.
Expand Down Expand Up @@ -426,7 +426,8 @@ def plot_grounding_rates(
plt.xticks(rotation=-20)
plt.legend(title="State")
plt.tight_layout()
plt.savefig(output_file, dpi=300)
if output_file:
plt.savefig(output_file, dpi=300)
plt.show()


Expand Down

0 comments on commit 18d01bb

Please sign in to comment.