# setwd("C:/Users/Wei-Ting/Dropbox/DataCoding/my_R/package/vennchart/rfiles")
rm(list =ls())
co_A <- 10
co_B <- 12
co_C <- 3
co_AB <- 1.9
co_BC <- 0.5
co_AC <-1

test using package from github

# install.packages("devtools")
 library(devtools)
 install_github("vennchart", "weitingwlin")
# install("~/Dropbox/DataCoding/my_R/package/vennchart")
# install("C:/Users/Wei-Ting/Dropbox/DataCoding/my_R/package/vennchart")
library(vennchart)
#source("sourceAll.R")
Q <- vennChart(A_all = co_A, B_all = co_B, 
                AandB = co_AB)
#source("sourceAll.R")
Q <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC)
L<-Q$circles$limits

move the plot to the bottom

L2 <- list("xlim" =  L$xlim, "ylim"= L$ylim +1.5)
L2
Q <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC, lim = L2)

vennChart

Paletton

#source("sourceAll.R")
Q <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC,
               colors = list(rgb(0.145, 0.51, 0.71, 0.4), 
                             rgb(1, 0.78, 0.16, 0.4),
                             rgb(1, 0.32, 0.16, 0.4)),
               textadj = c(1, 0.2),
               cex = 1.5,
               frameadj = 1.1
               )

3-step method

# source("plotvenn.R")
# source("plotvenntexts.R")
# source("sourceAll.R")

plotVenn(Q$circles, frameadj = 1.2)
plotVennTexts(Q$textspos, unit = "%)", connect = ":\n(")
title(main = "Title")

Another dataset

rm(list =ls())
co_A <- 10
co_B <- 12
co_C <- 3
co_AB <- 0
co_BC <- 0.5
co_AC <-1
Q <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC, frameadj = 1.2)

smaller plot but same frame

(so B = 12 in this graph will be the same size as in the previous graph)

co_A <- 3
co_AB <-0
co_BC <-0

R <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC, lim = Q$circles$limits,
               textadj = c(1.1,0))

is data is not logical:

co_A <- 1
co_AB <-1
co_BC <-0

R <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC, lim = Q$circles$limits,
               textadj = c(1.1,0))
R

make a percentage data

co_A <- 5
S <- vennChart(A_all = co_A, B_all = co_B, C_all = co_C,
                AandB = co_AB, AandC = co_AC, BandC = co_BC, 
               lim = list("xlim" = c(-5,5), "ylim" = c(-5, 5)),
               textadj = c(1.3,0.25), cex = 1.2,
               unit = "%)", connect = "\n(")


weitingwlin/vennchart documentation built on May 4, 2019, 4:18 a.m.