Create an interactive graphic to be used in a web browser.
This function is maintained for backward compatibility reasons, user shoud
now use function girafe
and girafe_options
.
ggiraph(code, ggobj = NULL, pointsize = 12, width = 0.75,
width_svg = 6, height_svg = 5, tooltip_extra_css = NULL,
hover_css = NULL, tooltip_opacity = 0.9, tooltip_offx = 10,
tooltip_offy = 0, tooltip_zindex = 999, zoom_max = 1,
selection_type = "multiple", selected_css = NULL, dep_dir = NULL,
xml_reader_options = list(), ...)
Plotting code to execute
ggplot objet to print. argument code
will
be ignored if this argument is supplied.
the default pointsize of plotted text in pixels, default to 12.
widget width ratio (0 < width <= 1). See below in section .
The width and height of the graphics region in inches. The default values are 6 and 5 inches. This will define the aspect ratio of the graphic as it will be used to define viewbox attribute of the SVG result.
The width and height of the graphics region in inches. The default values are 6 and 5 inches. This will define the aspect ratio of the graphic as it will be used to define viewbox attribute of the SVG result.
extra css (added to position: absolute;pointer-events: none;
)
used to customize tooltip area.
css to apply when mouse is hover and element with a data-id attribute.
tooltip opacity
tooltip x offset
tooltip y offset
tooltip css z-index, default to 999.
maximum zoom factor
row selection mode ("single", "multiple", "none") when widget is in a Shiny application.
css to apply when element is selected (shiny only).
Deprecated; the path where the output files are stored. If NULL
,
the current path for temporary files is used.
read_xml additional arguments to be used
when parsing the svg result. This feature can be used to parse
huge svg files by using list(options = "HUGE")
but this
is not recommanded.
arguments passed on to dsvg
# NOT RUN {
# ggiraph simple example -------
library(ggplot2)
dataset <- structure(list(qsec = c(16.46, 17.02, 18.61, 19.44, 17.02, 20.22
), disp = c(160, 160, 108, 258, 360, 225), carname = c("Mazda RX4",
"Mazda RX4 Wag", "Datsun 710", "Hornet 4 Drive", "Hornet Sportabout",
"Valiant"), wt = c(2.62, 2.875, 2.32, 3.215, 3.44, 3.46)), row.names = c("Mazda RX4",
"Mazda RX4 Wag", "Datsun 710", "Hornet 4 Drive", "Hornet Sportabout",
"Valiant"), class = "data.frame")
dataset
# plots
gg_point = ggplot(
data = dataset,
mapping = aes(x = wt, y = qsec, color = disp,
tooltip = carname, data_id = carname) ) +
geom_point_interactive() + theme_minimal()
girafe(ggobj = gg_point, width = .7)
# }
Run the code above in your browser using DataLab