Skip to content

Commit

Permalink
Merge pull request #55 from transferwise/notebook_rendering
Browse files Browse the repository at this point in the history
notebook rendering: add cluster plots
  • Loading branch information
AlxdrPolyakov authored May 14, 2024
2 parents 0f4b7ed + eb5daad commit f2e721b
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 147 deletions.
320 changes: 176 additions & 144 deletions notebooks/Finding interesting segments.ipynb

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions wise_pizza/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,21 @@ def plot_split_segments(
image_bytes = to_image(fig, format="png", scale=2)

if sf_size.relevant_cluster_names:
image_bytes2 = to_image(fig2, format="png", scale=2)
display(
Image(
image_bytes,
height=height + len(size_data.index) * 30,
width=width + len(size_data.index) * 30,
)
)
fig2.show()
display(
Image(
image_bytes2,
height=height + len(size_data.index) * 30,
width=width + len(size_data.index) * 30,
)
)

else:
# Display the static image in the Jupyter notebook
Expand Down Expand Up @@ -410,8 +417,9 @@ def plot_waterfall(
# Convert the figure to a static image
image_bytes = to_image(fig, format="png", scale=2)
if sf.relevant_cluster_names:
image_bytes2 = to_image(fig2, format="png", scale=2)
display(Image(image_bytes, height=height, width=width))
fig2.show()
display(Image(image_bytes2, height=height, width=width))
else:
# Display the static image in the Jupyter notebook
display(Image(image_bytes, width=width, height=height))
Expand Down
2 changes: 1 addition & 1 deletion wise_pizza/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def almost_equals(x1, x2, eps: float = 1e-6) -> bool:
def clean_up_min_max(min_nonzeros: int = None, max_nonzeros: int = None):
if min_nonzeros is not None:
logging.warning(
"min_segments parameter is deprecated, please use max_nonzeros instead."
"min_segments parameter is deprecated, please use max_segments instead."
)
if max_nonzeros is None:
if min_nonzeros is None:
Expand Down

0 comments on commit f2e721b

Please sign in to comment.