Skip to content
Adds interactive tooltip boxes to ggplots (standalone or rendered in Shiny)
R JavaScript CSS Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Fixed NA values when some panel is empty Aug 11, 2019
inst fix hiding tooltip when hover out Aug 14, 2019
man
tests Add compatibility switches for ggplot2 3.x Aug 10, 2019
.Rbuildignore Moved from the old repository May 8, 2019
.gitattributes preview image May 26, 2019
.gitignore Moved from the old repository May 8, 2019
.travis.yml More liberal Travis-CI behavior ;-) Aug 10, 2019
CHANGELOG.md version 0.2.1 Aug 14, 2019
DESCRIPTION version 0.2.1 Aug 14, 2019
LICENSE license in README + demo shiny app May 31, 2019
NAMESPACE get access to tooltipdata and pure html plot Jul 24, 2019
README.md fix typos in README Aug 13, 2019

README.md

ggtips - interactive tooltips for ggplots

Build

Our package provides a set of functions to enhance your ggplots with eye-pleasing tooltips easily, and render them in your Shiny apps.

Preview

plot with tooltips

Demo shiny app

Installation

To install ggtips, use devtools:

    devtools::install_github("Roche/ggtips")

Usage:

The main function - renderWithTooltips() - works similar to Shiny's renderUI(). To use it in your app, define an uiOutput element in the UI section (this will be the container for your plot), and substitute renderPlot() in your server logic with renderWithTooltips(), providing a list of variables you want to see in the tooltips:

    output[["myPlot"]] <- renderWithTooltips(
      plot = ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length)) + geom_point(aes(colour = Species)),
      varDict = list(Sepal.Width = "Width", Sepal.Length = "Length", Species = "Species")
    )

renderWithTooltips function accepts also optional customGrob parameter. It allows to pass modified grob object and as a result output tooltips coordinates will fits its geometries. This is useful if you want to add any extra geometry to your plot, e.g. bar with information or warning.

Options

  • plot - ggplot object
  • varDict - list of data to render on the tooltip that will be extracted from ggplot (keys are read data names and values are labels on tooltips)
  • customGrob - original grob object that can have grob manipulation
  • callback - function that can be used, to put additional data into tooltip, it should return string
  • width/height - number
  • point.size - size of the points

See our demo application (type ggtips::demo()) for example usage.

Docker demo

Optionally you can also build a Dockerized version of the demo: sudo docker build -t ggtips -f inst/Dockerfile .

After building the docker image (which can take a while) use the command:

    docker run -p 3838:3838 ggtips

The docker image starts in interactive mode (which means you can use ctrl+c to stop it) and exposes the web browser at port 3838.

Depending on your Docker setup, the exposed application may be available under:

http://localhost:3838

or may be exposed through the locally running docker-machine, which is the typical case with the Windows operating system that have no Hyper-V enabled. You can find more information about it on Hyper-V on Windows.

If your Docker setup is using docker-machine, you can find it's IP using command docker-machine ip, then use the http://{docker machine IP}:3838 address to connect to demo session.

See Docker setup tutorial to learn more about configuring Docker and Docker Machine Documentation to learn about docker-machine itself.

License

Copyright 2019 Genentech, Inc.

Released under Genentech Open License

You can’t perform that action at this time.