Skip to contents

Adds a Plotly plot to a webpage, based on specified or selected variables.

Usage

output_plot(x = NULL, y = NULL, color = NULL, color_time = NULL,
  dataview = NULL, id = NULL, click = NULL, subto = NULL,
  options = list(), plotly = TRUE)

Arguments

x

The name of a variable, or ID of a variable selector to plot along the x-axis.

y

The name of a variable, or ID of a variable selector to plot along the y-axis.

color

The name of a variable, or ID of a variable selector to use to color lines.

color_time

The ID of a selector to specify which timepoint of color to use.

dataview

The ID of an input_dataview component.

id

Unique ID for the plot.

click

The ID of an input to set to a clicked line's ID.

subto

A vector of output IDs to receive hover events from.

options

A list of configuration options, with named entries for any of data, layout, or options, potentially extracted from a saved plotly object (see Plotly documentation), if plotly is TRUE.

plotly

Logical; if TRUE, uses Plotly.

Value

A character vector of the content to be added.

Examples

# for mpg ~ wt * am in a site based on mtcars data
output_plot("wt", "mpg", "am")
#> [1] "<div class=\"plotly-wrap\"><div class=\"auto-output plotly\" data-x=\"wt\" data-y=\"mpg\" data-color=\"am\" id=\"plot\" data-autoType=\"plotly\"></table></div></div>"