hp12c
25 March 2013

これもまた、Graphvizなんです。

(追記:2014年3月3日) Gvizについてのまとめ頁を作りました。

Gvizの目次 - Rubyの世界からGraphvizの世界にこんにちは!


レイアウトを「osage」にすると、ノードを整列してくれます。

スクエア

require "colorable"
cs = Colorable::Colorset[:hsb]
global layout:'osage'
nodes shape:'square', style:'filled', penwidth:5
100.times do |i|
 node i.to_id, label:'', width:1.4, fillcolor:"#{cs.next.hex}bb"
end
save :g, :png

tile noshadow

サークル

require "colorable"
cs = Colorable::Colorset[:rgb]
global layout:'osage'
nodes shape:'circle', style:'filled', penwidth:5
100.times do |i|
 node i.to_id, label:'', width:1.4, fillcolor:"#{cs.next.hex}bb"
end
save :g, :png

tile noshadow

オクタゴン

require "colorable"
cs = Colorable::Colorset[:hsb]
global layout:'osage'
nodes shape:'doubleoctagon', style:'filled', penwidth:5
100.times do |i|
 node i.to_id, label:'', width:1.4, fillcolor:"#{cs.at(rand 100).hex}bb"
end
save :g, :png

tile noshadow

キレイですね!



Please enable JavaScript to view the comments powered by Disqus. blog comments powered by Disqus
ruby_pack8

100円〜で好評発売中!
M'ELBORNE BOOKS


AltStyle によって変換されたページ (->オリジナル) /