plot.variability {BasketballAnalyzeR}R Documentation

Plots a variability diagram from a 'variability' object

Description

Plots a variability diagram from a 'variability' object

Usage

## S3 method for class 'variability'
plot(
  x,
  title = "Variability diagram",
  ylim = NULL,
  ylab = NULL,
  size.lim = NULL,
  max.circle = 25,
  n.circle = 4,
  leg.brk = NULL,
  leg.pos = "right",
  leg.just = "left",
  leg.nrow = NULL,
  leg.title = NULL,
  leg.title.pos = "top",
  ...
)

Arguments

x

an aobject of class variability.

title

character, plot title.

ylim

numeric vector of length two, y-axis limits.

ylab

character, y-axis label.

size.lim

numeric vector of length two, set limits of the bubbles' size scale (see limits of scale_size).

max.circle

numeric, maximum size of the size plotting symbol (see range of scale_size).

n.circle

integer; if leg.brk=NULL, set a sequence of about n.circle+1 equally spaced 'round' values which cover the range of the values used to set the bubbles' size.

leg.brk

numeric vector, breaks for bubbles' size legend (see breaks of scale_size).

leg.pos

character or numeric vector of length two, legend position; available options "none", "left", "right" (default), "bottom", "top", or a c(x,y) numeric vector (x and y are coordinates of the legend box; their values should be between 0 and 1; c(0,0) corresponds to the bottom-left and c(1,1) corresponds to the top-right position).

leg.just

character or numeric vector of length two; anchor point for positioning legend inside plot ("left" (default), "center", "right" or two-element numeric vector) or the justification according to the plot area when positioned outside the plot.

leg.nrow

integer, number of rows of the bubbles' size legend.

leg.title

character, title of the bubbles' size legend.

leg.title.pos

character, position of the legend title; available options: "top" (default for a vertical legend), "bottom", "left" (default for a horizontal legend), or "right".

...

other graphical parameters.

Value

A ggplot2 object

Author(s)

Marco Sandri, Paola Zuccolotto, Marica Manisera (basketballanalyzer.help@unibs.it)

References

P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.

See Also

variability

Examples

Pbox.BC <- subset(Pbox, Team=="Oklahoma City Thunder" & MIN >= 500,
                    select=c("P2p","P3p","FTp","P2A","P3A","FTA"))
out <- variability(data=Pbox.BC, data.var=c("P2p","P3p","FTp"),
                   size.var=c("P2A","P3A","FTA"), weight=TRUE)
plot(out, leg.brk=c(10,25,50,100,500,1000), max.circle=30)

[Package BasketballAnalyzeR version 0.5.0 Index]