Title: | Interactive Venn Diagrams |
---|---|
Description: | Creates interactive Venn diagrams using the 'amCharts5' library for 'JavaScript'. They can be used directly from the R console, from 'RStudio', in 'shiny' applications, and in 'rmarkdown' documents. |
Authors: | Stéphane Laurent [aut, cre], amCharts team [cph] |
Maintainer: | Stéphane Laurent <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2024-10-30 04:15:33 UTC |
Source: | https://github.com/stla/amvenndiagram5 |
Given the cardinalities of some sets, returns all possible Venn diagrams of these sets.
allVennDiagrams(cardinalities, output = "dataframes")
allVennDiagrams(cardinalities, output = "dataframes")
cardinalities |
vector of positive integers |
output |
either |
List of Venn diagrams.
Creates an amVennDiagram
widget.
amVennDiagram( data, theme = "default", legendPosition = "right", elementId = NULL )
amVennDiagram( data, theme = "default", legendPosition = "right", elementId = NULL )
data |
a list such as one returned by |
theme |
the theme: |
legendPosition |
legend position: |
elementId |
a HTML id (usually useless) |
An amVennDiagram
widget.
sets <- list(A = 1:20, B = 10:30, C = 15:35) dat <- makeVennData(sets) amVennDiagram(dat, theme = "kelly")
sets <- list(A = 1:20, B = 10:30, C = 15:35) dat <- makeVennData(sets) amVennDiagram(dat, theme = "kelly")
Output and render functions for using amVennDiagram
within Shiny applications and interactive Rmd documents.
amVennDiagramOutput(outputId, width = "100%", height = "400px") renderAmVennDiagram(expr, env = parent.frame(), quoted = FALSE)
amVennDiagramOutput(outputId, width = "100%", height = "400px") renderAmVennDiagram(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width , height
|
a valid CSS dimension (like |
expr |
an expression that generates an |
env |
the environment in which to evaluate |
quoted |
logical, whether |
amVennDiagramOutput
returns an output element that can be
included in a Shiny UI definition, and renderAmVennDiagram
returns a
shiny.render.function
object that can be included in a Shiny server
definition.
if(require("shiny") && interactive()) { library(amVennDiagram5) library(shiny) sets <- list(A = 1:20, B = 15:38, C = c(0:5, 20, 30:40)) diagram <- makeVennData(sets) ui <- fluidPage( sidebarLayout( sidebarPanel( radioButtons( "theme", label = "Theme", choices = c( "default", "dark", "dataviz", "frozen", "kelly", "material", "moonrise", "spirited" ) ) ), mainPanel( amVennDiagramOutput("diagram", height = "95vh") ) ) ) server <- function(input, output, session) { output[["diagram"]] <- renderAmVennDiagram({ amVennDiagram( diagram, theme = input[["theme"]] ) }) } shinyApp(ui, server) }
if(require("shiny") && interactive()) { library(amVennDiagram5) library(shiny) sets <- list(A = 1:20, B = 15:38, C = c(0:5, 20, 30:40)) diagram <- makeVennData(sets) ui <- fluidPage( sidebarLayout( sidebarPanel( radioButtons( "theme", label = "Theme", choices = c( "default", "dark", "dataviz", "frozen", "kelly", "material", "moonrise", "spirited" ) ) ), mainPanel( amVennDiagramOutput("diagram", height = "95vh") ) ) ) server <- function(input, output, session) { output[["diagram"]] <- renderAmVennDiagram({ amVennDiagram( diagram, theme = input[["theme"]] ) }) } shinyApp(ui, server) }
Make data for usage in amVennDiagram
.
makeVennData(sets)
makeVennData(sets)
sets |
a named list of vectors representing some sets |
A list suitable for usage in amVennDiagram
.
sets <- list(A = 1:20, B = 10:30, C = 15:35) dat <- makeVennData(sets) amVennDiagram(dat, theme = "spirited")
sets <- list(A = 1:20, B = 10:30, C = 15:35) dat <- makeVennData(sets) amVennDiagram(dat, theme = "spirited")