diff --git a/lc_chart.png b/.github/lc_chart.png similarity index 100% rename from lc_chart.png rename to .github/lc_chart.png diff --git a/README.md b/README.md index 0b9d3f3..13cde8f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This README is generated using the following custom-built **Python** scripts: [` *** ## Progress Overview -![LeetCode stats](lc_chart.png?) +![LeetCode stats](.github/lc_chart.png?) ## Solutions Directory |ID|Difficulty|Type|Title|Solutions| diff --git a/scripts/lc_chart.py b/scripts/lc_chart.py index 729cc17..580a6df 100644 --- a/scripts/lc_chart.py +++ b/scripts/lc_chart.py @@ -2,6 +2,7 @@ import lc_constants as lcc import matplotlib.pyplot as plt import numpy as np +import pathlib as pl def chart_leetcode() -> None: @@ -61,9 +62,11 @@ def chart_leetcode() -> None: axes.set_title("Number of LeetCode solutions by language and level") axes.legend() - chart_name = "lc_chart" - plt.savefig(chart_name) - print(f"[SUCCESS] Chart image '{chart_name}.png' generated (total number of solutions: {int(totals[-1])})") + script_path = pl.Path(__file__).resolve() + chart_path = script_path.parent.parent / ".github" / "lc_chart.png" + + plt.savefig(chart_path) + print(f"[SUCCESS] Chart image generated in .github folder (total number of solutions: {int(totals[-1])})") if __name__ == "__main__": diff --git a/scripts/lc_constants.py b/scripts/lc_constants.py index 4a936c2..615ce66 100644 --- a/scripts/lc_constants.py +++ b/scripts/lc_constants.py @@ -1,6 +1,6 @@ REETKODE_SOLUTION_URL = "{folder}/{filename}" REETKODE_ICON_URL = ".github/icons/{icon}" -REETKODE_CHART_URL = "lc_chart.png?" +REETKODE_CHART_URL = ".github/lc_chart.png?" LEETCODE_PROBLEM_URL = "https://lcid.cc/{id}" IGNORED_DIRS = (".git", ".github", "icons", "scripts")