Skip to content

Commit

Permalink
Support explicitly specifying the periods to plot
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJCLaw committed Apr 14, 2024
1 parent fea93cd commit afe6202
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions plot-periods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)

0 comments on commit afe6202

Please sign in to comment.