Learn R Programming

⚠️There's a newer version (0.4.9) of this package.Take me there.

ggvis

Status

ggvis is currently dormant. We fundamentally believe in the ideas that underlie ggvis: reactive programming is the right foundation for interactive visualisation. However, we are not currently working on ggvis because we do not see it as the most pressing issue for the R community as you can only use interactive graphics once you've successfuly tackled the rest of the data analysis process.

We hope to come back to ggvis in the future; in the meantime you might want to try out plotly or creating inteactive graphics with shiny.

Introduction

The goal of ggvis is to make it easy to describe interactive web graphics in R. It combines:

  • a grammar of graphics from ggplot2,

  • reactive programming from shiny, and

  • data transformation pipelines from dplyr.

ggvis graphics are rendered with vega, so you can generate both raster graphics with HTML5 canvas and vector graphics with svg. ggvis is less flexible than raw d3 or vega, but is much more succinct and is tailored to the needs of exploratory data analysis.

If you find a bug, please file a minimal reproducible example at http://github.com/rstudio/ggvis/issues. If you're not sure if something is a bug, you'd like to discuss new features or have any other questions about ggvis, please join us on the mailing list: https://groups.google.com/group/ggvis.

Installation

Install the latest release version from CRAN with:

install.packages("ggvis")

Install the latest development version with:

# install.packages("devtools")
devtools::install_github("hadley/lazyeval", build_vignettes = FALSE)
devtools::install_github("hadley/dplyr", build_vignettes = FALSE)
devtools::install_github("rstudio/ggvis", build_vignettes = FALSE)

Getting started

You construct a visualisation by piping pieces together with %>%. The pipeline starts with a data set, flows into ggvis() to specify default visual properties, then layers on some visual elements:

mtcars %>% ggvis(~mpg, ~wt) %>% layer_points()

The vignettes, available from http://ggvis.rstudio.com/, provide many more details. Start with the introduction, then work your way through the more advanced topics. Also check out the various demos in the demo/ directory. See the basics in demo/scatterplot.r then check out the the coolest demos, demo/interactive.r and demo/tourr.r.

Copy Link

Version

Install

install.packages('ggvis')

Monthly Downloads

3,133

Version

0.4.4

License

GPL-2 | file LICENSE

Maintainer

Winston Chang

Last Published

September 28th, 2018

Functions in ggvis (0.4.4)

compute_boxplot

Calculate boxplot values
create_input

Create a new interactive "input" object.
input_text

Create an interactive text or numeric input box.
band

A band
bin_vector

Bin vectors
get_data

Get data from a ggvis object
fullseq

Generate sequence of fixed size intervals covering range.
layer_densities

Transformation: density estimate
is.axis_props

Tests whether an object is an axis_props object
default_options

Default options
layer_f

Create a new layering function.
add_axis

Add a vega axis specification to a ggvis plot
add_props

Add visual properties to a visualisation
axis_props

Create an axis_props object for controlling axis properties.
handle_resize

Handlers and interactive inputs for plot sizing.
input_checkbox

Create an interactive checkbox.
compute_tabulate

Count data at each location of a categorical variable
left_right

Interactive inputs bound to arrow keys.
create_broker

Create a broker object
add_data

Add dataset to a visualisation
legend_props

Create an axis_props object for controlling legend properties.
compute_align

Align positions using length.
compute_model_prediction

Create a model of a data set and compute predictions.
save_spec

Tools to save and view static specs.
marks

Vega marks.
cocaine

Cocaine seizures in the US.
scale_datetime

Add a date-time scale to a ggvis object.
ggvis

Visualise a data set with a ggvis graphic.
explain.ggvis

Print out the structure of a ggvis object in a friendly format
ggvisControlOutput

Create a ggvis control output element in UI
compute_count

Count data at each location
compute_density

Compute density of data.
set_options

Set options for a ggvis plot
scaletype_to_vega_scaletype

Given the type of a ggvis scale, get the name of its corresponding vega scale
compute_stack

Stack overlapping data.
layer_guess

Guess the right type of layer based on current properties.
handle_click

Handle mouse actions on marks.
handle_brush

Handle brush events on a visualisation.
dplyr-ggvis

Dplyr verbs for ggvis.
is.ggvis

Is an object a ggvis object?
layer_histograms

Display binned data
explain

Explain details of an object
is.legend_props

Tests whether an object is a legend_props object
sidebarBottomPage

Create a page with a sidebar
ggvis_scale

Create a new ggvis_scale object.
is.scaled_value

Tests whether an object is a scaled_value object
linked_brush

Create a linked brush object.
new_prop

Create new prop object
singular

singular.
group_by

Divide data into groups.
export_png

Export a PNG or SVG from a ggvis object
knit_print.ggvis

Knit print method for ggvis plots.
input_select

Create interactive control to select one (or more options) from a list.
input_slider

Create an interactive slider.
zero_range

Determine if range of vector is close to zero, with a specified tolerance
mark

Create a new "mark" object.
scaled_value

Create a scaled_value object
padding

Define padding.
layer_bars

Display data with bars (a barchart).
ggvisOutputElements

Create HTML elements for ggvis output
scales

Add a scale to a ggvis plot
ggvis_message

Send a message to ggvis running on client
is.broker

Determine if an object is a broker object
%>%

Pipe graphics
layer_boxplots

Display data with a boxplot.
prop_domain

Property domain.
propname_to_scale

Convert the name of a property to the name of its default scale.
print.ggvis

View in a ggvis plot in the browser.
prop

Create a property.
is.dynamic

Determine if an ggvis is dynamic (i.e. needs to be run in a shiny app)
resolution

Compute the "resolution" of a data vector.
props

Manage a list of properties.
show_spec

Print out the vega plot specification
subvis

Create a subvisualisation.
vector_type

Determine the "type" of a vector
vega_data_parser

Determine the vega data type for a vector
waggle

Waggle back and forth between two numbers
show_tooltip

Send a message to the client to show or hide a tooltip
layer_lines

Layer lines on a plot.
layer_model_predictions

Overlay model predictions or a smooth curve.
scale_numeric

Add a numeric scale to a ggvis object.
scale_ordinal

Add a ordinal, nominal, or logical scale to a ggvis object.
shiny-ggvis

Connect a ggvis graphic to a shiny app.
set_scale_label

Set the label for a scale
add_legend

Add a vega legend specification to a ggvis plot
add_guide_axis

Defunct function for adding an axis
add_guide_legend

Defunct function for adding a legend
add_relative_scales

Add x_rel and y_rel scales
add_tooltip

Add tooltips to a plot.
add_scale

Add arbitrary scales to ggvis.
compute_bin

Bin data along a continuous variable
auto_group

Automatically group data by grouping variables
as.vega

Coerce an ggvis object to a vega list.