Skip to content

Instantly share code, notes, and snippets.

@HarlanH
Created August 31, 2014 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HarlanH/1ea36cc7e436596fdfb5 to your computer and use it in GitHub Desktop.
Save HarlanH/1ea36cc7e436596fdfb5 to your computer and use it in GitHub Desktop.
VennEuler code for 3 statistical programming languages, per Randy Zwitch
using VennEuler
# 1 364 23.30% SAS only
# 10 350 22.41% Python only
# 11 70 4.48% Python and SAS
# 100 490 31.37% R only
# 101 68 4.35% R and SAS
# 110 200 12.80% R and Python
# 111 20 1.28% R, Python and SAS
labels = ["R", "Python", "SAS"]
mk(pattern, ct) = pattern .* fill(true, ct, 1)
data = vcat(mk([false false true], 354),
mk([false true false], 350),
mk([false true true], 70),
mk([true false false], 490),
mk([true false true], 68),
mk([true true false], 200),
mk([true true true], 20))
eo = make_euler_object(labels, data, [EulerSpec(:circle, [.5, .5], [0, 0]),
EulerSpec(:triangle), EulerSpec(:square)], sizesum=.25)
(minf,minx,ret) = optimize(eo, random_state(eo), ftol=-1, xtol=0.0025, maxtime=60, pop=200)
println("got $minf at $minx (returned $ret)")
render("randy_venn.svg", eo, minx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment