Skip to contents

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

Usage

dotplotOutput(output_id, width = "100%", height = "560px")

renderDotplot(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 dotplot() widget.

env

The environment in which to evaluate expr.

quoted

Is expr already quoted? Defaults to FALSE.

Value

dotplotOutput() returns a Shiny output UI element; renderDotplot() returns a Shiny render function.

Examples

if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  df <- expand.grid(gene = c("CD3D", "MS4A1"), cluster = c("T", "B"),
                    stringsAsFactors = FALSE)
  df$pct <- c(88, 4, 6, 91)
  df$value <- c(2.4, 0.1, 0.2, 2.7)
  ui <- fluidPage(dotplotOutput("dp"))
  server <- function(input, output) {
    output$dp <- renderDotplot(dotplot(df))
  }
  shinyApp(ui, server)
}