- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How to create a Venn diagram in R?

A Venn diagram helps to identify the common and uncommon elements between two or more than two sets of elements. This is also used in probability theory to visually represent the relationship between two or more events. To create a Venn diagram in R, we can make use of venn function of gplots package.

## Example

Consider the below vectors

x<-c(rep(c(1,2,3),times=c(4,5,8)),12,15,20) y<-c(1:10,25)

Installing and loading gplots package −

install.packages("gplots") library(gplots)

Creating the Venn diagram for x and y −

venn(list(x,y))

## Output

If we have three variables then we will just add the third variable in venn function as shown below −

z<-c(5:15,21) venn(list(x,y,z))

## Output

- Related Questions & Answers
- Python Matplotlib Venn diagram
- How to create matrix diagram in R?
- How to create colored Venn Diagrams?
- How to Create a Use Case Diagram?
- How to modify the font size in Matplotlib-venn?
- How to create a sphere in R?
- How to create a polynomial model in R?
- How to create a frequency polygon in R?
- How to create a covariance matrix in R?
- How to create a staircase plot in R?
- How to create a sparse matrix in R?
- How to create a dummy variable in R?
- Difference between Sequence Diagram and Activity Diagram
- Difference between Sequence diagram and Collaboration diagram
- How to create permutations as a list in R?

Advertisements