GithubHelp home page GithubHelp logo

cran / venn Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 3.0 1.61 MB

:exclamation: This is a read-only mirror of the CRAN R package repository. venn — Draw Venn Diagrams. Homepage: https://github.com/dusadrian/venn Report bugs for this package: https://github.com/dusadrian/venn/issues

R 100.00%

venn's Introduction

Package venn

This package produces Venn diagrams for up to seven sets, using any Boolean union of set intersections.

Installation

Install the stable version from CRAN:

install.packages("venn")

Examples

A simple Venn diagram with 3 sets

venn(3)

With a vector of counts: 1 for "000", 2 for "001" etc.

venn(3, counts = 1:8)

Display the first whole set

venn("1--")

Same with

venn("A", snames = "A, B, C")

An equivalent command, from the union of all intersections

venn("100 + 110 + 101 + 111")

Same with

venn("A~B~C + AB~C + A~BC + ABC")

Adding the labels for the intersections

venn("1--", ilabels = TRUE)

Using different parameters for the borders

venn(4, lty = 5, col = "navyblue")

Using ellipses

venn(4, lty = 5, col = "navyblue", ellipse = TRUE)

A 5 sets Venn diagram

venn(5)

A 5 sets Venn diagram using ellipses

venn(5, ellipse = TRUE)

A 5 sets Venn diagram with intersection labels

venn(5, ilabels = TRUE)

And a predefined color style

venn(5, ilabels = TRUE, zcolor = "style")

A union of two sets

venn("1---- + ----1")

Same with

venn("A + E", snames = "A, B, C, D, E")

With different colors

venn("1---- , ----1", zcolor = "red, blue")

Same using SOP - sum of products notation

venn("A, E", snames = "A, B, C, D, E", zcolor = "red, blue")

Same colors for the borders

venn("1---- , ----1", zcolor = "red, blue", col = "red, blue")

A 6 sets diagram

venn(6)

Seven sets "Adelaide"

venn(7)

Artistic version

venn(c("1000000", "0100000", "0010000", "0001000",
       "0000100", "0000010", "0000001", "1111111"))

Without all borders

venn(c("1000000", "0100000", "0010000", "0001000",
       "0000100", "0000010", "0000001", "1111111"),
     borders = FALSE)

Using SOP - sum of products notation

venn("A + B~C", snames = "A, B, C, D")

The input can be a list

set.seed(12345)
x <- list(First = 1:20, Second = 10:30, Third = sample(25:50, 15))
venn(x)

Or a dataframe

set.seed(12345)
x <- as.data.frame(matrix(sample(0:1, 150, replace = TRUE), ncol = 5))
venn(x)

Using ggplot2 graphics

venn(x, ggplot = TRUE)

Increasing the border size

venn(x, ggplot = TRUE, size = 1.5)

With dashed lines

venn(x, ggplot = TRUE, linetype = "dashed")

Venn diagrams for QCA objects

library(QCA)

data(CVF)
obj <- truthTable(CVF, "PROTEST", incl.cut = 0.85)

venn(obj)

Custom labels for intersections

pCVF <- minimize(obj, include = "?")
venn(pCVF$solution[[1]], zcol = "#ffdd77, #bb2020, #1188cc")
cases <- paste(c("HungariansRom", "CatholicsNIreland", "AlbaniansFYROM",
                 "RussiansEstonia"), collapse = "\n")
coords <- unlist(getCentroid(getZones(pCVF$solution[[1]][2])))
text(coords[1], coords[2], labels = cases, cex = 0.85)

venn's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.