Ruby|Gviz로 다양한 layout 시도
Ruby|Gviz로 다양한 layout 시도
개요
Gviz에서 다양한 layout을 시도합니다.
Layouts
Graphiviz의 layout에는 다음과 같은 종류가 있습니다.
※ 링크 목표는 공식 문서(PDF)
코드
require "gviz"
sexagenary_cycle = %w(子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥)
layouts = %i(circo dot fdp neato osage patchwork sfdp twopi)
layouts.each do |layout|
Graph do
global layout: layout, label:"sexagenary_#{layout}", fontsize:20, size:15, overlap:false
nodes fontname:'MS GOTHIC', colorscheme: :paired12, style: :filled
sexagenary_cycle.each_with_index do |e, i|
edge "eto_#{i}"
node :"#{i}", { label: e, fillcolor: i%12}
end
node :"eto", { label: '干支', fillcolor: :white }
node :"0", { label: sexagenary_cycle.first, fillcolor: 1 }
node :"11", { label: sexagenary_cycle.last, fillcolor: 12 }
save :"sexagenary_#{layout}", :png
end
end
출력
circo 출력 결과

dot 출력 결과

fdp 출력 결과

neato 출력 결과

osage 출력 결과

patchwork 출력 결과

sfdp 출력 결과

tworpi 출력 결과

Reference
이 문제에 관하여(Ruby|Gviz로 다양한 layout 시도), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/tbpgr/items/89953979fbf12b8aac0c텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)