AtomScott/SportsLabKit

Incorrect kwargs handling in visualize_frame

Opened this issue · 0 comments

Search before asking

  • I have searched the SoccerTrack issues and found no similar bug report.

SoccerTrack Component

Other

Bug

When visualizing codf, if the information of the marker of home_team is edited from the argument, it is also reflected in the marker information of away_team.

Environment

No response

Minimal Reproducible Example

For example, if home_kwargs is set as follows, the output will be as follows

...

codf.visualize_frame(1, 
                ball_key="BALL", 
                home_kwargs={"zorder": 10, "ms": 10, "markerfacecolor": "w"},
)

...

codf_outpy

Additional

Simply modify the visualize_frame function in cofinatesdataframe.py slightly.

before

        _away_kwargs = merge_dicts(
            _marker_kwargs,
            {"zorder": 10, "ms": 10, "markerfacecolor": "r"},
            marker_kwargs,
            home_kwargs,
        )

after

        _away_kwargs = merge_dicts(
            _marker_kwargs,
            {"zorder": 10, "ms": 10, "markerfacecolor": "r"},
            marker_kwargs,
            away_kwargs,
        )

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!