do_viz_shots_scatter: Visualization of the shots statistics

View source: R/do_viz_shots_scatter.R

do_viz_shots_scatterR Documentation

Visualization of the shots statistics

Description

Create a visualization of the left half of the court and annotates both the total and by zone shooting statistics. It can also show the location of each individual shot, with color-coding for makes and misses.

Usage

do_viz_shots_scatter(shots_stats, type, draw, size_lab_box = 2.8, size_lab_court = 3, 
                     size_point = 3, language = "English", title_add = "", 
                     pch_two_shot = 4, pch_three_shot = 17,
                     color_made_shot = "darkblue", color_missed_shot = "red",
                     point_intens = 0.4)

Arguments

shots_stats

Shooting data associated with the filters given to do_shots_stats.

type

Options are 'team' for team statistics, 'player' for player statistics and 'all' for the whole league.

draw

Logical. TRUE to add the shots in their coordinates. FALSE to add just the number of mades and attempted field goals.

size_lab_box

Size of the text indicating the overall percentages (they are inside a box).

size_lab_court

Size of the text indicating the percentages by zone.

size_point

Size of the points.

language

Language of the titles. Valid options are 'English' and 'Spanish' so far.

title_add

Add additional information to the title if some filters have been applied to the input data frame.

pch_two_shot

Point shape of the two-point shots. A number between 0 and 25. Default is 4 (cross).

pch_three_shot

Point shape of the three-point shots. A number between 0 and 25. Default is 17 (filled triangle point-up).

color_made_shot

Color for the made shots. Default is dark blue.

color_missed_shot

Color for the missed shots. Default is red.

point_intens

Intensity of the point symbols when plotting all the shots (draw=TRUE).

Value

A plot.

Note

The shapes and colors for the shots are only needed when draw=TRUE, i.e., when the locations of the shots are plotted.

Author(s)

Guillermo Vinue

See Also

do_divide_court_zones, do_filter_data, do_shots_stats

Examples

## Not run: 
df0 <- do_divide_court_zones(acb_shooting_data_2425)

df1 <- do_filter_data(df0, "2024-2025", "", "", "", "", "")

shots_stats <- do_shots_stats(df1, df0) 

do_viz_shots_scatter(shots_stats, "all", FALSE) 
do_viz_shots_scatter(shots_stats, "all", TRUE)

df1 <- do_filter_data(df0, "2024-2025", "", "", "", "", "D. Ennis")

shots_stats <- do_shots_stats(df1, df0) 

do_viz_shots_scatter(shots_stats, "player", FALSE) 
do_viz_shots_scatter(shots_stats, "player", TRUE)
do_viz_shots_scatter(shots_stats, "player", TRUE, language = "Spanish")

## End(Not run)


BAwiR documentation built on Sept. 8, 2026, 1:06 a.m.