Learn R Programming

VennDiagram (version 1.6.20)

draw.single.venn: Draw a Venn Diagram with a Single Set

Description

Creates a Venn diagram with a single set.

Usage

draw.single.venn(area, category = "", lwd = 2, lty = "solid", col = "black", fill = NULL,
	alpha = 0.5, label.col = "black", cex = 1, 
	fontface = "plain", fontfamily = "serif",
	cat.pos = 0, cat.dist = 0.025, cat.cex = 1, cat.col = "black",
	cat.fontface = "plain", cat.fontfamily = "serif",
	cat.just = list(c(0.5, 0.5)),
	cat.default.pos = "outer", cat.prompts = FALSE, rotation.degree = 0,
	rotation.centre = c(0.5, 0.5), ind = TRUE, ...)

Arguments

area

The size of the set

category

The category name of the set

lwd

width of the circle's circumference

lty

dash pattern of the circle's circumference

col

Colour of the circle's circumference

fill

Colour of the circle's area

alpha

Alpha transparency of the circle's area

label.col

Colour of the area label

cex

size of the area label

fontface

fontface of the area label

fontfamily

fontfamily of the area label

cat.pos

The position (in degrees) of the category name along the circle, with 0 (default) at 12 o'clock

cat.dist

The distance (in npc units) of the category name from the edge of the circle (can be negative)

cat.cex

size of the category name

cat.col

Colour of the category name

cat.fontface

fontface of the category name

cat.fontfamily

fontfamily of the category name

cat.just

List of 1 vector of length 2 indicating horizontal and vertical justification of the category name

cat.default.pos

One of c('outer', 'text') to specify the default location of category names (cat.pos and cat.dist are handled differently)

cat.prompts

Boolean indicating whether to display help text on category name positioning or not)

rotation.degree

Number of degrees to rotate the entire diagram

rotation.centre

A vector (length 2) indicating (x,y) of the rotation centre

ind

Boolean indicating whether the function is to automatically draw the diagram in the end or not

...

Additional arguments to be passed, including margin, which indicates amount of whitespace around the final diagram in npc units

Value

Returns an object of class gList containing the grid objects that make up the diagram. Also displays the diagram in a graphical device unless specified with ind = FALSE. Grid::grid.draw can be used to draw the gList object in a graphical device.

Details

This function mostly complements other functions in the VennDiagram package that draws multi-set diagrams by providing a function that draws single-set diagrams with similar graphical options.

Examples

Run this code
# NOT RUN {
# A simple single-set diagram
venn.plot <- draw.single.venn(100, "First");
grid.draw(venn.plot);
grid.newpage();

# A more complicated diagram
venn.plot <- draw.single.venn(
	area = 365,
	category = "All\nDays",
	lwd = 5,
	lty = "blank",
	cex = 3,
	label.col = "orange",
	cat.cex = 4,
	cat.pos = 180,
	cat.dist = -0.20,
	cat.col = "white",
	fill = "red",
	alpha = 0.15
	);
grid.draw(venn.plot);
grid.newpage();

# Writing to file
tiff(filename = "Single_Venn_diagram.tiff", compression = "lzw");
venn.plot <- draw.single.venn(100, "First", ind = FALSE);
grid.draw(venn.plot);
dev.off();
# }

Run the code above in your browser using DataLab