Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

J chan hkust filename patch #27

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/july/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def cal_heatmap(
cmax: Optional[int] = None,
cbar_label_format: Optional[str] = None,
ax: Optional[Axes] = None,
filename: str = None,
):
if not ax:
figsize = (12, 5) if horizontal else (5, 12)
Expand Down Expand Up @@ -100,6 +101,10 @@ def cal_heatmap(
ax.set_title(title)

ax.set_frame_on(frame_on)

if filename is not None:
plt.savefig(filename)

return ax


Expand Down
6 changes: 6 additions & 0 deletions src/july/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def heatmap(
cmax: Optional[int] = None,
cbar_label_format: Optional[str] = None,
ax: Optional[Axes] = None,
filename: str = None,
**kwargs
) -> Axes:
"""Create heatmap of input dates and data.
Expand Down Expand Up @@ -92,6 +93,7 @@ def heatmap(
cmax=cmax,
cbar_label_format=cbar_label_format,
ax=ax,
filename = filename
)

return ax
Expand All @@ -116,6 +118,7 @@ def month_plot(
cmax: Optional[int] = None,
cbar_label_format: Optional[str] = None,
ax: Optional[Axes] = None,
filename: str = None,
**kwargs
) -> Axes:
"""Create calendar shaped heatmap of one month in input dates and data.
Expand Down Expand Up @@ -184,6 +187,7 @@ def month_plot(
cmax=cmax,
cbar_label_format=cbar_label_format,
ax=ax,
filename = filename
)

ax.tick_params(axis="y", pad=8)
Expand Down Expand Up @@ -225,6 +229,7 @@ def calendar_plot(
title: bool = True,
ncols: int = 4,
figsize: Optional[Tuple[float, float]] = None,
filename: str = None,
**kwargs
) -> Axes:
"""Create calendar shaped heatmap of all months im input dates and data.
Expand Down Expand Up @@ -287,6 +292,7 @@ def calendar_plot(
value_format=value_format,
ax=axes.reshape(-1)[i],
cal_mode=True,
filename = filename
)

for ax in axes.reshape(-1)[len(year_months) :]:
Expand Down