From afe62025de1a87a9a7687577de55556b2823e07b Mon Sep 17 00:00:00 2001 From: Peter Law Date: Sun, 14 Apr 2024 13:01:46 +0100 Subject: [PATCH] Support explicitly specifying the periods to plot --- plot-periods.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plot-periods.py b/plot-periods.py index 56b6074..d07b35b 100755 --- a/plot-periods.py +++ b/plot-periods.py @@ -30,7 +30,7 @@ def game_point_by_period(tla, match_periods): yield total -def plot(final_match_num, tlas, highlight, output): +def plot(final_match_num, tlas, highlight, periods, output): if tlas is None: tlas = comp.teams.keys() @@ -52,7 +52,9 @@ def plot(final_match_num, tlas, highlight, output): for t, x in teams_and_hues ] - match_periods = comp.schedule.match_periods[:-1] + match_periods = comp.schedule.match_periods + if periods: + match_periods = [match_periods[x] for x in periods] n_cols = len(teams_and_colours) + 3 width = 1 / n_cols @@ -97,6 +99,13 @@ def plot(final_match_num, tlas, highlight, output): help='list of TLAs of teams to highlight in plot', nargs='+', ) + parser.add_argument( + '--periods', + help="Set explicit periods by index", + type=int, + nargs=argparse.ONE_OR_MORE, + required=False, + ) parser.add_argument( '--output', required=True, @@ -105,4 +114,4 @@ def plot(final_match_num, tlas, highlight, output): args = parser.parse_args() - plot(args.final_match_num, args.teams, args.highlight, args.output) + plot(args.final_match_num, args.teams, args.highlight, args.periods, args.output)