Skip to contents

Make a graph interactive

Usage

ggi(
  plot = ggplot2::last_plot(),
  width = NULL,
  height = NULL,
  keep_ratio = TRUE,
  savewidget = FALSE,
  dir = NULL,
  name = "Plot",
  replace = FALSE,
  open = rlang::is_interactive(),
  ...,
  iframe,
  pixel_width
)

Arguments

plot

The graph, made with ggfacto (or ggmca, ggca, ggpca, ggpca_cor_circle), with or without ggplot2 elements added with +. A graph that is already interactive is returned as it is.

width

The width in centimeters. Default to printing device's size.

height

The height in centimeters. Default to printing device's size.

keep_ratio

By default, the height is forced based of the relative size of the MCA's axes. Set to FALSE to avoid this behavior.

savewidget

Should the html widget be saved on disk ? The file is standalone: one single .html carrying its own JavaScript, ready to be sent to someone, or shown in an <iframe>: the graph fills the window or the frame it is opened in.

dir

If saved as file, the directory in which to save the html widget. Default to temporary directory. Set global option "ggfacto.export_dir" with link[base:options](options) to change default directory.

name

The name of the file to save.

replace

Replace file ? By default, number added to find a new name.

open

Should the resulting file be opened at once ?

...

Additional arguments to pass to girafe and dsvg. The widget embeds the Liberation Sans font alone; font_set (see gdtools::font_set()) embeds others.

iframe, pixel_width

Deprecated and ignored: the widget sizes itself.

Value

An html plot, of class ggfacto_widget. In a knitr document, setting option "ggfacto.widget_dir" writes it to its own file and embeds an <iframe> instead of the widget itself: see ggfacto_widget.