Skip to content

Instantly share code, notes, and snippets.

@thash
Last active August 29, 2015 14:10
Show Gist options
  • Save thash/b4804a271f6c87d9b0c9 to your computer and use it in GitHub Desktop.
Save thash/b4804a271f6c87d9b0c9 to your computer and use it in GitHub Desktop.

Rubyで適当な値のデータを作り, RのVennDiagramライブラリで描画

ame = (Date.today.beginning_of_year..Date.today.end_of_year).to_a.sample(100).map(&:to_s)
jiko = (ame.sample(20) + (Date.today.beginning_of_year..Date.today.end_of_year).to_a.sample(50)).uniq.map(&:to_s)
uni = (Date.today.beginning_of_year..Date.today.end_of_year).to_a.map(&:to_s)

なんとなく雨の日が事故率高いように狙って作成してる. それぞれprintしてRコンソールにコピペ(原始的)

install.packages("VennDiagram", repos="http://cran.ism.ac.jp/")
library(VennDiagram)

ame <- c(...)
jiko <- c(...)
uni <- c(...)

venn.diagram(list(事故=jiko, 雨=ame, uni), filename="a.png", cat.fontfamily="Ricty")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment