getTooltips: Get tooltips

View source: R/tooltips.R

getTooltipsR Documentation

Get tooltips

Description

Returns a list of tooltips for a ggplot, grouped by plot geometries and layers. Each element of the list is a data frame with HTML-formatted tooltip contents (column 'tooltip') and coordinates relative to the size of the image ('coordX' and 'coordY').

Usage

getTooltips(plot, varDict, plotScales, g, callback, addAttributes = FALSE)

Arguments

plot

A ggplot object.

varDict

Variable dictionary in the following format: list(<variable> = <label>, ...), where <variable> is a valid name of a variable mapped with aes, and <label> is a character string. It defines the composition of information displayed in tooltips.

plotScales

A list with two fields: x and y. Defines axis scales (transformations) for the purpose of displaying original values in tooltips. If NULL (default), values are displayed "as is".

g

A gtable object compiled from the plot (see arrangeGrob).

callback

Callback function for adding custom content to the tooltips (see the example app).

addAttributes

Logical parameter determinig whether extra geom attributes should be add to tooltip object.


Roche/ggtips documentation built on May 14, 2022, 12:44 p.m.