Skip to content

Commit

Permalink
tigh_layout
Browse files Browse the repository at this point in the history
  • Loading branch information
glemaitre committed Jan 22, 2025
1 parent d720d03 commit 9172cc6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/technical_details/plot_cache_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,12 @@
# because we don't need to re-compute the predictions.
#
# The cache also speeds up plots. Let's create a ROC curve:
import matplotlib.pyplot as plt

start = time.time()
display = report.metrics.plot.roc(pos_label="allowed")
end = time.time()
plt.tight_layout()

# %%
print(f"Time taken: {end - start:.2f} seconds")
Expand All @@ -185,6 +188,7 @@
start = time.time()
display = report.metrics.plot.roc(pos_label="allowed")
end = time.time()
plt.tight_layout()

# %%
print(f"Time taken: {end - start:.2f} seconds")
Expand All @@ -194,6 +198,7 @@
# We only use the cache to retrieve the `display` object and not directly the matplotlib
# figure. It means that you can still customize the cached plot before displaying it:
display.plot(roc_curve_kwargs={"color": "tab:orange"})
plt.tight_layout()

# %%
#
Expand Down

0 comments on commit 9172cc6

Please sign in to comment.