Skip to content

Commit a38449e

Browse files
authored
Merge pull request #41 from hugovk/add-args
2 parents 3f4c5c5 + f53cf13 commit a38449e

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

src/stravavis/cli.py

+39-6
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,31 @@ def main():
4949
"--activities_path", help="Path to activities.csv from Strava bulk export zip"
5050
)
5151
parser.add_argument(
52-
"--year_min", help="The minimum year to use for the calendar heatmap."
52+
"--year_min",
53+
type=int,
54+
help="The minimum year to use for the calendar heatmap and dumbbell.",
5355
)
5456
parser.add_argument(
55-
"--year_max", help="The maximum year to use for the calendar heatmap."
57+
"--year_max",
58+
type=int,
59+
help="The maximum year to use for the calendar heatmap and dumbbell.",
5660
)
5761
parser.add_argument(
5862
"--max_dist",
63+
type=float,
5964
help="Maximum daily distance for the calendar heatmap; "
6065
"values above this will be capped.",
6166
)
62-
parser.add_argument("--fig_height", help="Figure height for the calendar heatmap.")
63-
parser.add_argument("--fig_width", help="Figure width for the calendar heatmap.")
67+
parser.add_argument(
68+
"--fig_height",
69+
type=float,
70+
help="Figure height for the calendar heatmap and dumbbell.",
71+
)
72+
parser.add_argument(
73+
"--fig_width",
74+
type=float,
75+
help="Figure width for the calendar heatmap and dumbbell.",
76+
)
6477
parser.add_argument(
6578
"--local_timezone",
6679
help="Timezone for determining local times for activities. "
@@ -134,12 +147,32 @@ def main():
134147
if activities is not None:
135148
print("Plotting calendar...")
136149
outfile = f"{args.output_prefix}-calendar.png"
137-
plot_calendar(activities, output_file=outfile)
150+
fig_height = args.fig_height or 15
151+
fig_width = args.fig_width or 9
152+
plot_calendar(
153+
activities,
154+
args.year_min,
155+
args.year_max,
156+
args.max_dist,
157+
fig_height,
158+
fig_width,
159+
outfile,
160+
)
138161
print(f"Saved to {outfile}")
139162

140163
print("Plotting dumbbell...")
141164
outfile = f"{args.output_prefix}-dumbbell.png"
142-
plot_dumbbell(activities, output_file=outfile)
165+
fig_height = args.fig_height or 34
166+
fig_width = args.fig_width or 34
167+
plot_dumbbell(
168+
activities,
169+
args.year_min,
170+
args.year_max,
171+
args.local_timezone,
172+
fig_height,
173+
fig_width,
174+
outfile,
175+
)
143176
print(f"Saved to {outfile}")
144177

145178

0 commit comments

Comments
 (0)