bubbleplot {BasketballAnalyzeR}R Documentation

Draws a bubble plot

Description

Draws a bubble plot

Usage

bubbleplot(
  data,
  id,
  x,
  y,
  col,
  size,
  text.col = NULL,
  text.size = 2.5,
  scale.size = TRUE,
  labels = NULL,
  mx = NULL,
  my = NULL,
  mcol = NULL,
  title = NULL,
  repel = TRUE,
  text.legend = TRUE
)

Arguments

data

a data frame.

id

character, name of the ID variable.

x

character, name of the x-axis variable.

y

character, name of the y-axis variable.

col

character, name of variable on the color axis.

size

character, name of variable on the size axis.

text.col

character, name of variable for text colors.

text.size

integer, text font size.

scale.size

logical; if TRUE, size variable is rescaled between 0 and 100.

labels

character vector, variable labels (on legend and axis).

mx

numeric, x-coordinate of the vertical axis; default is the mean value of x variable.

my

numeric, y-coordinate of the horizontal axis; default is the mean value of y variable.

mcol

numeric, midpoint of the diverging scale (see scale_colour_gradient2); default is the mean value of col variable.

title

character, plot title.

repel

logical; if TRUE, activate text repelling.

text.legend

logical; if TRUE, show the legend for text color.

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.

Examples

X <- with(Tbox, data.frame(T=Team, P2p=P2p, P3p=P3p, FTp=FTp, AS=P2A+P3A+FTA))
labs <- c("2-point shots (% made)","3-point shots (% made)",
          "free throws (% made)","Total shots attempted")
bubbleplot(X, id="T", x="P2p", y="P3p", col="FTp",
           size="AS", labels=labs)

[Package BasketballAnalyzeR version 0.5.0 Index]