Skip to content

Commit

Permalink
Updated plotting test
Browse files Browse the repository at this point in the history
Updated the plot test to now plt.show() the figure. Instead, the user will use plt.show() if desired.
  • Loading branch information
djlaky committed Mar 4, 2024
1 parent d193e65 commit fb543c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions idaes/apps/grid_integration/multiperiod/price_taker_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,13 @@ def get_optimal_n_clusters(
)

if plot == True:
plt.show()
plt.plot(k_values, inertia_values)
plt.axvline(x=n_clusters, color="red", linestyle="--", label="Elbow")
plt.xlabel("Number of clusters")
plt.ylabel("Inertia")
plt.title("Elbow Method")
plt.xlim(kmin, kmax)
plt.grid()
plt.show()

return int(n_clusters), inertia_values

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def test_elbow_plot(excel_data):

daily_data = m.generate_daily_data(excel_data["BaseCaseTax"])
m.get_optimal_n_clusters(daily_data, plot=True)
test_fig = plt.gcf()
plt.close('all')

assert plt.gcf() is not None
assert test_fig is not None


@pytest.mark.unit
Expand Down

0 comments on commit fb543c7

Please sign in to comment.