Draw Venn and Euler diagram in 2D or 3D
vennplot(disjoint.combinations = NULL, vars = NULL, Delta = 0.1,
ThreeD = FALSE, lambda = NULL, stressWay = c("sum", "combine"),
delta = 0.01, weight = NULL, expand = NULL, twoWayGenerate = FALSE,
scaleSearch = c("NelderMead", "lineSearch", "goldenSectionSearch", "BFGS",
"CG", "L-BFGS-B", "SANN", "Brent"), twoWaySearch = c("lineSearch",
"NelderMead", "goldenSectionSearch", "BFGS", "CG", "L-BFGS-B", "SANN",
"Brent"), scaleSeachTolerance = list(value = 1e-05, proportional = FALSE),
distanceTolerance = list(value = 1e-05, proportional = FALSE),
lossTolerance = list(ToleranceofLoss = 1e-10, maximumStep = 10, ALPHA =
0.01, ToleranceofStepsize = 1e-05, proportional = FALSE),
stressBound = 0.001, maximumStep = 50, planeSize = 50, lower = -Inf,
upper = Inf, control = list(), hessian = FALSE, mar = rep(1, 4),
cols = NULL, alpha = 0.3, smooth = FALSE, ...)
Named numeric vector or data.frame where each column should be factor. See Details.
Extract specific variables of data.frame as disjoint.combinations
. If vars = NULL
, all the information of data.frame will be extracted.
The length of step for method "lineSearch" or the initial interval of test points for method "NelderMead".
Draw Venn diagram in 3D. See Examples.
It can be NULL
or a numeric vector. If lambda = NULL
, the loss function optimize lambda, else, based on the given lambda, loss function will calculate stress respectively then return the minimum one and corresponding lambdas.
If data set can be separated into a few groups, there will be two ways to express stress: one is to sum up all the stress (named "sum"; default), the other is to use total TSS divide by total RSS (named "combine").
Closeness between groups.
The weight of disjoint.combinations
. It should have the same length with disjoint.combinations
.
If some balls should not intersect and the code fails to detect it. It is possible to be fixed manually but sacrificing stress.
Boolean factor, if false, any missing intersections are set as zero.
Provide multiple methods to optimize scale lambda. The default method is "NelderMead". See Details.
If two way intersections are missing, multiple methods are available to generate two way intersections. The default method is "lineSearch". See Details.
A list with tolerance value and boolean factor " proportional". The loop of NelderMead and lineSearch in scaleSearch will end when the difference or proportional difference matches the tolerance value.
A list with tolerance value and boolean factor " proportional". The Newton method of finding distance will end when the difference or proportional difference matches the tolerance value.
A list with ToleranceofLoss, maximumStep, ALPHA, ToleranceofStepsize and boolean factor "proportional". If ALPHA is null, the step size will be searched through Newton method and it will stop when step reaches the maximum step or the difference matches ToleranceofStepsize; else step size will be fixed with ALPHA . The loss will end when the difference or proportional difference or the total loss value matches the "ToleranceofLoss".
The loop of method NelderMead will stop when stress is beyond the stressBound.
The maximum searching step for method NelderMead and Newton method of calculating distance.
The plane size of calculating disjoint intersections numerically.
The lower bound of the interval to be searched for the "goldenSectionSearch" and "L-BFGS-B". See Details.
The upper bound of the interval to be searched for the "goldenSectionSearch" and "Brent". See Details.
A list of control parameters. See Details
Logical. A numerically differentiated Hessian matrix be returned or not. See Details.
Plot margins.
Color of balls. If NULL
, rainbow color will be set.
Color darkness.
For 3D plot, if true, the balls will be much more smoother. However, based on the high resolution, if the number of balls is too much, when rotating, the new window stumbles.
Any further graphical parameters to be passed to the plot
function.
An object of the class vennplot
with following components:
centres of the balls (columns are (x
, y
) or (x
, y
, z
) coordinates).
radii of the balls.
total loss of vennplot
.
stress value for solution.
1. One way sets must be given in disjoint.combination
. e.g.disjoint.combination = c( B=2, AB=0.5)
is not allowed. disjoint.combination = c(A = 0, B=2, AB=0.5)
works.
2. Except "NelderMead" and "lineSearch", "goldenSectionSearch" in scaleSearch
and twoWaySearch
is based on optimize
and the rest methods are based on optim
.
3. lower
, upper
, control
and hessian
share the same parameters with optim
, and lower
, upper
can also be used in optimize
# NOT RUN {
# 3D Venn plot with arbitray sets
disjoint.combinations = c(A=80, B=50,C=100, D = 100,E = 100,
"A&C"=30, "A&D"= 30,"B&E" = 30, "A&E" = 40, h = 40, "B&h" = 10)
ve = vennplot(disjoint.combinations, ThreeD = TRUE)
# data frame
vennplot(disjoint.combinations = sharks, vars = c("Au","USA","Fa","Sex"),
scaleSearch = "lineSearch", expand = 1.1)
# }
Run the code above in your browser using DataCamp Workspace