Skip to content

Commit

Permalink
implement timeseries_plot feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ronylpatil committed Jul 9, 2024
1 parent 4a42bae commit 75ae3d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ matplotlib==3.9.0
matplotlib-stubs==0.2.0
wordcloud==1.9.3
nltk==3.8.1
seaborn==0.13.2
# cmd: pipreqs . --savepath custom_requirements.txt
24 changes: 13 additions & 11 deletions src/chatInsights/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def active_day(self, save_figure: str = "N") -> None:
if save_figure == "Y" or save_figure == "y":
plt.savefig("active_day.png", bbox_inches="tight")
plt.show()

def active_month(self, save_figure: str = "N") -> None:
"""
Generate a bar chart show users activity month-wise.
Expand Down Expand Up @@ -252,25 +252,27 @@ def timeseries_plot(self, save_figure: str = "N", marker: str = "") -> None:
Specify the marker.
Try out '.','o','*','^','<','>','p','P','h','H','X','x','+','1','2','3','4'
Default is None.
Returns:
--------
None
"""

# function implementation
plt.figure(figsize=(8, 4))
sns.lineplot(x = self.data["month_year"], y = self.data["msg_count_monthly"], marker = marker, color = 'red', linewidth = 1)
plt.xticks(rotation = 90)
sns.lineplot(
x=self.data["month_year"],
y=self.data["msg_count_monthly"],
marker=marker,
color="red",
linewidth=1,
)
plt.xticks(rotation=90)
plt.xlabel("Months")
plt.ylabel("No. of messages")
plt.title("Monthly Message Stats", fontdict = {"fontsize": 11})
plt.tight_layout(pad = 2)
plt.title("Monthly Message Stats", fontdict={"fontsize": 11})
plt.tight_layout(pad=2)
if save_figure == "Y" or save_figure == "y":
plt.savefig("timeseries.png")

plt.show()




0 comments on commit 75ae3d2

Please sign in to comment.