「proce55ing-gr03」の編集履歴(バックアップ)一覧に戻る

proce55ing-gr03 - (2009/01/29 (木) 18:25:30) のソース

*Processingでgraph 03

『ビジュアライジング・データ Processingによる情報視覚化手法』
を見ながらグラフを書いてみようと思います。

Processingでgraph 02のつづきです。
参考:pp.246



&bold(){使うもの:}Processing

----
・単語の出てきた回数をEdgeクラスとNodeクラスのcountでカウントしていたので、これを使って、重要度を丸の大きさで表示。(ちなみに右クリックで固定解除。)
#image(graph06.gif,width=300,height=313,center,http://www34.atwiki.jp/ninja22?cmd=upload&act=open&pageid=53&file=graph06.gif)
#center(){(クリックで拡大)}


・作り方
(1) 先のプログラム同様、Nodeクラスのdraw() を以下のように書き換えます。(前回からの変更箇所に"//**"がついています。)
#highlight(c){{  void draw(){
    if (fixed){
      fill(nodeColor);
      stroke(0);
      strokeWeight(0.5);
      
      rectMode(CORNER);
      float w = textWidth(label) + 10;
      float h = textAscent() + textDescent() + 4;
      ellipse(x, y, count, count); //**
      fill(0);
      textAlign(CENTER, CENTER);
      text(label, x, y);
    } 
    else {
      fill(nodeColor);
      stroke(0);
      strokeWeight(0.5);
      ellipse(x, y, count, count); //**
    }
  }
}}


----

どのグラフが好きか、使いたいか、相応しいかは自分で決めてください。

今回自分がこれを作成してみたのは、より扱いやすいマインドマップを作成したかったからです。Processingでgraphがこの程度できればマインドマップは作れるだろう…。

----
#center(){◆ ◆ ◆}
----