Learn R Programming

bubbles (version 0.2)

bubbles: bubbles.

Description

bubbles.

Creates a bubble chart.

Usage

bubbles(value, label, key = NULL, tooltip = "", color = "#EEEEEE",
  textColor = "#333333", width = NULL, height = NULL)

Arguments

value

Numeric vector of values, used for sizing bubbles. The value will be proportional to the radius, not the area; for area, call sqrt on the value.

label

Character vector of textual labels to use on bubbles

key

Values that will uniquely identify a bubble across runs. This doesn't matter for static bubble charts, but if a bubble chart receives updates (i.e. in a Shiny app) then d3.js will use the key to know which bubbles in the "before" state correspond with which bubbles in the "after" state, and perform smooth transitions. If NULL, then the key will effectively be the row number.

tooltip

Character vector of tooltip values, to be shown on hover

color

Character vector of bubble color values, in "#RRGGBB" format; can be length 1 or length of value

textColor

Character vector of text color values, in "#RRGGBB" format; can be length 1 or length of value

width

The width of the widget, or NULL for default.

height

The height of the widget, or NULL for default.

Value

A widget object that can be printed at the console, outputted as part of an R Markdown document, or used in a Shiny app with renderBubbles.

Examples

Run this code
# NOT RUN {
bubbles(runif(10), LETTERS[1:10], color = rainbow(10, alpha = NULL))
# }

Run the code above in your browser using DataLab