plot.variability: Plots a variability diagram from a 'variability' object

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/plot.variability.R

Description

Plots a variability diagram from a 'variability' object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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

1
2
3
4
5
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)

Example output

Loading required package: ggplot2
Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2

If you want to reproduce the figures contained in the book of
Zuccolotto and Manisera (2020) and
if the version of your R machine is >= 3.6.0, you need to type
RNGkind(sample.kind = "Rounding")
at the beginning of your working session

BasketballAnalyzeR documentation built on July 2, 2020, 2:14 a.m.