fix(heatmap): 使用绝对路径并去掉热力图月份和星期标签
- 文件路径改为基于 __file__ 的绝对路径,确保 cron 运行时正确保存 - 去掉 weekday_label 和 month_label 避免文字挤在一起 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5211f9cb8a
commit
062b12166e
@ -18,7 +18,8 @@ client = Mastodon(
|
||||
api_base_url="https://nofan.xyz",
|
||||
)
|
||||
|
||||
fn = "./heatmap.txt"
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
fn = os.path.join(base_dir, "heatmap.txt")
|
||||
# read from file if exists
|
||||
date = []
|
||||
data = []
|
||||
@ -79,9 +80,9 @@ with open(fn, "w") as f:
|
||||
f.close()
|
||||
|
||||
cleaned_date, cleaned_data = july.utils.preprocess_inputs(date, data)
|
||||
july.heatmap(cleaned_date, cleaned_data, cmap="BuGn")
|
||||
july.heatmap(cleaned_date, cleaned_data, cmap="BuGn", month_grid=False, weekday_label=False, month_label=False)
|
||||
|
||||
img_path = "./heatmap.png"
|
||||
img_path = os.path.join(base_dir, "heatmap.png")
|
||||
plt.savefig(img_path, bbox_inches="tight")
|
||||
|
||||
# upload image to mastodon
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user