Skip to content

Commit

Permalink
Plot moved to its own module
Browse files Browse the repository at this point in the history
  • Loading branch information
lim185 committed Sep 30, 2025
1 parent 108d156 commit 92092c3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions visualize/visualize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#-*- coding: utf-8 -*-
"""
visualize.py
"""

import typing

import matplotlib.pyplot as plt

def visualize_data_distribution(data: DataFrame) -> None:
for category in ["treatment", "target"]:
select = data.select(category) \
.groupby(category) \
.count()
plt.barh(
np.array(select.select(category).collect()).squeeze(),
np.array(select.select("count").collect()).astype("float") \
.squeeze())
plt.xlabel("Count")
plt.ylabel(category)
plt.savefig(f"{category}_counts.png", bbox_inches="tight")
plt.close()

# EOF

0 comments on commit 92092c3

Please sign in to comment.