Package index
-
ggplot()
- Create a new ggplot plot.
-
animint()
- Create an animint
-
aes()
- Define aesthetic mappings.
-
`+`(<gganimint>)
`%+%`
`%+replace%`
- Add a new component to a ggplot or theme object.
-
ggsave()
- Save a ggplot (or other grid object) with sensible defaults
-
qplot()
quickplot()
- Quick plot
Layers
Layers determine how a graph looks and consist of the data; either a geom, a statistical transformation, or both; aesthetics; and possible position adjustments. Graphs may have more than one layer. It’s possible to use layer()
to generate layers, but many people find it to be prolix. It’s convention to instead use a geom or stat function.
-
layer()
- Create a new layer
Geoms
Geoms are geometric objects used to determine the kind of data visualization you’ll be generating. For example, you’d select geom_point()
for a scatterplot and geom_line()
for a line plot.
-
geom_abline()
geom_hline()
geom_vline()
- Lines: horizontal, vertical, and specified by slope and intercept.
-
geom_bar()
stat_count()
- Bars, rectangles with bases on x-axis
-
geom_bin2d()
stat_bin_2d()
- Add heatmap of 2d bin counts.
-
geom_blank()
- Blank, draws nothing.
-
geom_contour()
stat_contour()
- Display contours of a 3d surface in 2d.
-
geom_count()
stat_sum()
- Count the number of observations at each location.
-
geom_density()
stat_density()
- Display a smooth density estimate.
-
geom_density_2d()
stat_density_2d()
- Contours from a 2d density estimate.
-
geom_dotplot()
- Dot plot
-
geom_errorbarh()
- Horizontal error bars
-
geom_hex()
stat_bin_hex()
- Hexagon binning.
-
geom_freqpoly()
geom_histogram()
stat_bin()
- Histograms and frequency polygons.
-
geom_jitter()
- Points, jittered to reduce overplotting.
-
geom_crossbar()
geom_errorbar()
geom_linerange()
geom_pointrange()
- Vertical intervals: lines, crossbars & errorbars.
-
geom_map()
- Polygons from a reference map.
-
geom_path()
geom_line()
geom_step()
- Connect observations.
-
geom_point()
- Points, as for a scatterplot
-
geom_polygon()
- Polygon, a filled path.
-
geom_ribbon()
geom_area()
- Ribbons and area plots.
-
geom_rug()
- Marginal rug plots.
-
geom_segment()
geom_curve()
- Line segments and curves.
-
geom_smooth()
stat_smooth()
- Add a smoothed conditional mean.
-
geom_spoke()
- A line segment parameterised by location, direction and distance.
-
geom_tallrect()
- ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements.
-
geom_label()
geom_text()
- Textual annotations.
-
geom_raster()
geom_rect()
geom_tile()
- Draw rectangles.
-
geom_violin()
stat_ydensity()
- Violin plot.
-
geom_widerect()
- ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements.
-
update_geom_defaults()
update_stat_defaults()
- Modify geom/stat aesthetic defaults for future plots
Stats
Stats are similar to geoms. They differ only in that they summarize or transform the data in some way.
-
geom_bar()
stat_count()
- Bars, rectangles with bases on x-axis
-
geom_bin2d()
stat_bin_2d()
- Add heatmap of 2d bin counts.
-
geom_contour()
stat_contour()
- Display contours of a 3d surface in 2d.
-
geom_count()
stat_sum()
- Count the number of observations at each location.
-
geom_density()
stat_density()
- Display a smooth density estimate.
-
geom_density_2d()
stat_density_2d()
- Contours from a 2d density estimate.
-
geom_hex()
stat_bin_hex()
- Hexagon binning.
-
geom_freqpoly()
geom_histogram()
stat_bin()
- Histograms and frequency polygons.
-
geom_smooth()
stat_smooth()
- Add a smoothed conditional mean.
-
geom_spoke()
- A line segment parameterised by location, direction and distance.
-
geom_violin()
stat_ydensity()
- Violin plot.
-
stat_ecdf()
- Empirical Cumulative Density Function
-
stat_ellipse()
- Plot data ellipses.
-
stat_function()
- Superimpose a function.
-
stat_identity()
- Identity statistic.
-
stat_summary_bin()
stat_summary()
- Summarise y values at unique/binned x x.
-
stat_summary_2d()
stat_summary_hex()
- Bin and summarise in 2d (rectangle & hexagons)
-
stat_unique()
- Remove duplicates.
-
update_geom_defaults()
update_stat_defaults()
- Modify geom/stat aesthetic defaults for future plots
-
position_dodge()
- Adjust position by dodging overlaps to the side.
-
position_identity()
- Don't adjust position
-
position_jitter()
- Jitter points to avoid overplotting.
-
position_jitterdodge()
- Adjust position by simultaneously dodging and jittering
-
position_nudge()
- Nudge points.
-
position_fill()
position_stack()
- Stack overlapping objects on top of one another.
Annotations
Annotations denote reference points or important features in a data visualization. They don’t inherit settings from the animint or static data visualization.
-
geom_abline()
geom_hline()
geom_vline()
- Lines: horizontal, vertical, and specified by slope and intercept.
-
annotate()
- Create an annotation layer.
-
annotation_custom()
- Annotation: Custom grob.
-
annotation_logticks()
- Annotation: log tick marks
-
annotation_map()
- Annotation: maps.
-
annotation_raster()
- Annotation: High-performance rectangular tiling.
-
borders()
- Create a layer of map borders.
-
animint()
- Create an animint
-
animint2dir()
- Compile and render an animint in a local directory.
-
animint2pages()
- Publish a list of ggplots as interactive visualizations on a GitHub repository
-
animintOutput()
- Shiny ui output function
-
renderAnimint()
- Create an animint output element
Animint Helpers
These functions give you more control over your animint or make doing things with animints a little more convenient.
-
addShowSelectedForLegend()
- Add a showSelected aesthetic if legend is specified
-
addSSandCSasAesthetics()
- Add the showSelected/clickSelects params to the aesthetics mapping
-
make_bar()
- Convenience function for an interactive bar that might otherwise be created using stat_summary(geom="bar").
-
make_tallrect()
- Make a clickSelects geom_tallrect that completely tiles the x range. This makes it easy to construct tallrects for the common case of selecting a particular x value.
-
make_tallrect_or_widerect()
- Make a clickSelects geom_widerect or geom_tallrect that completely tiles the x or y range. This function is used internally by make_tallrect or make_widerect, which are more user-friendly.
-
make_text()
- Convenvience function for a showSelected plot label.
-
make_widerect()
- Make a clickSelects geom_widerect that completely tiles the y range. This makes it easy to construct widerects for the common case of selecting a particular y value.
-
setPlotSizes()
- Set plot width and height for all plots
-
switch_axes()
- Flip axes in case of coord_flip Switches column names. Eg. xmin to ymin, yntercept to xintercept etc.
Data Manipulation
Animints take data, but they also output it. These functions give you control over both the data inputted and outputted.
-
colsNotToCopy()
- Filter out columns that do not need to be copied
-
getCommonChunk()
- Save the common columns for each tsv to one chunk
-
getLayerName()
- Gives a unique name to each layer in
saveLayer
-
getLayerParams()
- Get all parameters for a layer
-
getLegend()
- Function to get legend information for each scale
-
getLegendList()
- Function to get legend information from ggplot
-
getTextSize()
- Function to process text size with different types of unit
-
getUniqueAxisLabels()
- Get unique axis labels for the plot
-
issueSelectorWarnings()
- Issue warnings for selectors
-
merge_recurse()
- Merge a list of data frames.
-
newEnvironment()
- Environment to store meta data
-
parsePlot()
- Convert a ggplot to a list.
-
saveChunks()
- Split data set into chunks and save them to separate files.
-
selectSSandCS()
- Separate .variable/.value selectors
-
split_recursive()
- Split data.frame into recursive list of data.frame.
-
varied.chunk()
- Extract subset for each data.frame in a list of data.frame
Coordinates
By default, animint2 uses a Cartesian coordinate system. These functions allow you to tweak or change the coordinate system your data visualization uses.
-
coord_cartesian()
- Cartesian coordinates.
-
coord_fixed()
- Cartesian coordinates with fixed relationship between x and y scales.
-
coord_flip()
- Flipped cartesian coordinates.
-
coord_map()
coord_quickmap()
- Map projections.
-
coord_polar()
- Polar coordinates.
-
coord_trans()
- Transformed cartesian coordinate system.
Themes
Themes give you broad control over the appearance of everything in the data visualization orthogonal to the data. theme()
gives you control over a single data visualization, while theme_set()
modifies all future visualizations.
-
theme_grey()
theme_gray()
theme_bw()
theme_linedraw()
theme_light()
theme_minimal()
theme_classic()
theme_dark()
theme_void()
- ggplot2 themes
-
theme()
- Set theme elements
-
theme_animint()
- theme for passing animint specific params
-
theme_update()
theme_replace()
theme_get()
theme_set()
- Get, set and update themes.
-
element_blank()
- Theme element: blank. This theme element draws nothing, and assigns no space
-
element_line()
- Theme element: line.
-
element_rect()
- Theme element: rectangle.
-
element_text()
- Theme element: text.
-
margin()
- Define margins.
-
add_theme()
- Modify properties of an element in a theme object
-
calc_element()
- Calculate the element properties, by inheriting properties from its parents
-
rel()
- Relative sizing for theme elements
Aesthetics
Aesthetics control how the data are connected to visual aspects of a data visualizations. You can use aes()
to control color, transparency, size, shape, and more.
-
aes_()
aes_string()
aes_q()
- Define aesthetic mappings from strings, or quoted calls and formulas.
-
aes_colour_fill_alpha
colour
color
fill
- Colour related aesthetics: colour, fill and alpha
-
aes_linetype_size_shape
linetype
size
shape
- Differentiation related aesthetics: linetype, size, shape
-
aes_position
x
y
xmin
xmax
ymin
ymax
xend
yend
- Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
-
update_labels()
- Update axis/legend labels
-
labs()
xlab()
ylab()
ggtitle()
- Change axis labels, legend titles, plot title/subtitle and below-plot caption.
-
expand_limits()
- Expand the plot limits with data.
-
scale_alpha()
scale_alpha_continuous()
scale_alpha_discrete()
- Alpha scales.
-
scale_colour_brewer()
scale_fill_brewer()
scale_colour_distiller()
scale_fill_distiller()
- Sequential, diverging and qualitative colour scales from colorbrewer.org
-
scale_x_continuous()
scale_y_continuous()
scale_x_log10()
scale_y_log10()
scale_x_reverse()
scale_y_reverse()
scale_x_sqrt()
scale_y_sqrt()
- Continuous position scales (x & y).
-
scale_x_date()
scale_y_date()
scale_x_datetime()
scale_y_datetime()
- Position scale, date & date times
-
scale_x_discrete()
scale_y_discrete()
- Discrete position.
-
scale_colour_gradient()
scale_fill_gradient()
scale_colour_gradient2()
scale_fill_gradient2()
scale_colour_gradientn()
scale_fill_gradientn()
- Smooth gradient between two colours
-
scale_colour_grey()
scale_fill_grey()
- Sequential grey colour scale.
-
scale_colour_hue()
scale_fill_hue()
- Qualitative colour scale with evenly spaced hues.
-
scale_colour_identity()
scale_fill_identity()
scale_shape_identity()
scale_linetype_identity()
scale_alpha_identity()
scale_size_identity()
- Use values without scaling.
-
scale_linetype()
scale_linetype_continuous()
scale_linetype_discrete()
- Scale for line patterns.
-
scale_colour_manual()
scale_fill_manual()
scale_size_manual()
scale_shape_manual()
scale_linetype_manual()
scale_alpha_manual()
- Create your own discrete scale.
-
scale_shape()
- Scale for shapes, aka glyphs.
-
scale_radius()
scale_size()
scale_size_area()
- Scale size (area or radius).
-
scale_size_animint()
- Scale point sizes using circle area, but specifying the radius in pixels.
-
guide_colourbar()
guide_colorbar()
- Continuous colour bar guide.
-
guide_legend()
- Legend guide.
-
guides()
- Set guides for each scale.
-
facet_grid()
- Lay out panels in a grid.
-
facet_null()
- Facet specification: a single panel.
-
facet_wrap()
- Wrap a 1d ribbon of panels into 2d.
-
label_bquote()
- Backquoted labeller
-
labeller()
- Generic labeller function for facets
-
label_value()
label_both()
label_context()
label_parsed()
label_wrap_gen()
- Labeller functions
-
as_labeller()
- Coerce to labeller function
Helpers
Some additional functions that aren’t at the core of animint2. Most of them are used for convenience or automation.
Automation
autoplot()
is used to automate plot production, while the fortify
functions are used to automate tidying dataframes.
-
autoplot()
- Create a complete ggplot appropriate to a particular data type
-
fortify()
- Fortify a model with data.
-
fortify(<lm>)
- Supplement the data fitted to a linear model with model fit statistics.
-
fortify(<map>)
- Fortify method for map objects.
-
fortify(<SpatialPolygonsDataFrame>)
fortify(<SpatialPolygons>)
fortify(<Polygons>)
fortify(<Polygon>)
fortify(<SpatialLinesDataFrame>)
fortify(<Lines>)
fortify(<Line>)
- Fortify method for classes from the sp package.
-
map_data()
- Create a data frame of map data.
Extending Animint2
You don’t need to stick with just the functions animint2 gives you. Use these functions to make your own geoms, stats, and scales.
-
knit_print(<animint>)
- Insert an interactive animation into an R markdown document using a customized print method.
-
print(<animint>)
- print animint
-
print(<gganimintplot>)
plot(<gganimintplot>)
- Draw plot on current graphics device.
-
print(<gganimintproto>)
- Print a gganimintproto object
-
as.list(<gganimintproto>)
- Convert a gganimintproto object to a list
-
format(<gganimintproto>)
- Format a gganimintproto object
-
gganimintproto()
gganimintproto_parent()
- Create a new gganimintproto object
-
is.gganimintproto()
- Is an object a gganimintproto object?
-
aes_()
aes_string()
aes_q()
- Define aesthetic mappings from strings, or quoted calls and formulas.
-
knit_print(<animint>)
- Insert an interactive animation into an R markdown document using a customized print method.
-
print(<animint>)
- print animint
-
print(<gganimintplot>)
plot(<gganimintplot>)
- Draw plot on current graphics device.
-
print(<gganimintproto>)
- Print a gganimintproto object
Helping Functions
These are convenience functions that may be helpful when making data visualizations.
-
cut_interval()
cut_number()
cut_width()
- Cut up numeric vector into useful groups.
-
mean_cl_boot()
mean_cl_normal()
mean_sdl()
median_hilow()
- Wrap up a selection of summary functions from Hmisc to make it easy to use with
stat_summary
.
-
mean_se()
- Calculate mean and standard errors on either side.
-
pt.to.lines()
- Convert
pt
value tolines
-
resolution()
- Compute the "resolution" of a data vector.
-
toRGB()
- Convert R colors to RGB hexadecimal color values
Datasets
animint2 comes with a wide range of datasets. Use them to experiment with plot-building and animints.
-
breakpoints
- The breakpointError of simulated signals
-
change
- Graphical model structure change
-
ChromHMMiterations
- ChromHMM iterations
-
climate
- Climate data in central America from 1995 to 2000
-
compare
- Testing rank and compare SVM on simulated patterns
-
diamonds
- Prices of 50,000 round cut diamonds
-
economics
economics_long
- US economic time series.
-
faithfuld
- 2d density estimate of Old Faithful data
-
FluView
- FluView
-
FunctionalPruning
- Functional Pruning Algorithm
-
generation.loci
- Evolution simulation
-
intreg
- Interval regression
-
luv_colours
colors()
in Luv space.
-
malaria
- Malaria parasite genome variants
-
midwest
- Midwest demographics.
-
mixtureKNN
- K-Nearest-Neighbors model of the mixture example data
-
montreal.bikes
- Montreal bikes
-
mpg
- Fuel economy data from 1999 and 2008 for 38 popular models of car
-
msleep
- An updated and expanded version of the mammals sleep dataset.
-
PeakConsistency
- Consistency of segmentation models in simulated Poisson peaks
-
pirates
- Worldwide pirate attacks from 1978 to 2013
-
presidential
- Terms of 11 presidents from Eisenhower to Obama.
-
prior
- Class prior change
-
prostateLasso
- Lasso model of the prostate cancer data set
-
seals
- Vector field of seal movements.
-
TestROC
- Test ROC curves
-
txhousing
- Housing sales in TX.
-
UStornadoes
- Tornadoes in the United States from 1950 to 2012
-
VariantModels
- Error rates of supervised learning methods for variant calling
-
vervet
- Vervet monkey intestinal microbiome
-
WorldBank
- Demographics by country from 1960 to 2012
-
worldPop
- World population by subcontinent
-
checkAnimationTimeVar()
- Check animation variable for errors
-
checkExtraParams()
- Check
extra_params
argument for duplicates, non-named list
-
checkForSSandCSasAesthetics()
- Check if showSelected and clickSelects have been used as aesthetics as in old syntax. If yes, raise error
-
checkPlotForAnimintExtensions()
- Performs error checking on the plot for animint extensions
-
checkPlotList()
- Check plot.list for errors
-
checkSingleShowSelectedValue()
- Issue warnings for non interactive plots where there is only one showSelected value
-
is.gganimintproto()
- Is an object a gganimintproto object?
-
is.rel()
- Reports whether x is a rel object
-
is.rgb()
- Check if character is an RGB hexadecimal color value
-
is.theme()
- Reports whether x is a theme object
-
issueSelectorWarnings()
- Issue warnings for selectors