This function creates a lollipop chart to visualize probabilities.

lollipops(
  data,
  plotBackgroundColor = "white",
  plotBackgroundOpacity = 0.8,
  title = "Probability of an impact",
  leftArea = "Negative",
  rightArea = "Positive",
  mediumText = 18,
  bigText = 28,
  width = NULL,
  height = NULL,
  elementId = NULL,
  logoPath = NULL,
  logoSize = 100,
  logoLocation = c("bottom-left", "top-left", "top-right", "bottom-right"),
  rightAreaText = "A positive impact is not necesarly a large impact.",
  leftAreaText = "A negative impact is not necesarly a large impact."
)

Arguments

data

A data frame containing the probabilities to visualize.

plotBackgroundColor

The background color of the plot.

plotBackgroundOpacity

The opacity of the plot background.

title

The title of the plot.

leftArea

The label for the left area of the plot.

rightArea

The label for the right area of the plot.

mediumText

The font size for medium text elements.

bigText

The font size for big text elements.

width

The width of the widget (optional).

height

The height of the widget (optional).

elementId

The element ID of the widget (optional).

logoPath

Logo path. Defaults to NULL.

logoSize

Logo size. Defaults to FALSE.

logoLocation

Logo location. c('bottom-right', 'top-left', 'top-right', 'bottom-left').

rightAreaText

The tooltip text for the right area of the plot.

leftAreaText

The tooltip text for the left area of the plot.

Value

A HTML widget object representing the lollipop chart.

Details

The data frame should have three columns: `name`, `value`, and `color`. The `name` column specifies the names of the data points, while the `value` column specifies the corresponding probabilities. The `color` column specifies the color of each lollipop.

Examples

data <- data.frame(
  Name = c("Outcome 1", "Outcome 2", "Outcome 3"),
  Prior = c(0.5, 0.5, 0.5),
  Posterior = c(0.2, 0.6, 0.9)
)
lollipops(data,
  logoPath = 'https://upload.wikimedia.org/wikipedia/commons/b/b8/YouTube_Logo_2017.svg',
  logoLocation = 'bottom-left')