Skip to contents

Output and render functions for using lollipop() within Shiny applications and interactive R Markdown / Quarto documents.

Usage

lollipopOutput(output_id, width = "100%", height = "440px")

renderLollipop(expr, env = parent.frame(), quoted = FALSE)

Arguments

output_id

Output variable to read from.

width, height

Element size, passed to htmlwidgets::shinyWidgetOutput().

expr

An expression that generates a lollipop() widget.

env

The environment in which to evaluate expr.

quoted

Is expr already quoted? Defaults to FALSE.

Value

lollipopOutput() returns a Shiny output UI element; renderLollipop() returns a Shiny render function.

Examples

if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  ui <- fluidPage(lollipopOutput("lp"))
  server <- function(input, output) {
    output$lp <- renderLollipop({
      lollipop(position = c(100, 250, 400), label = c("A", "B", "C"),
               protein_length = 500)
    })
  }
  shinyApp(ui, server)
}