物理のかぎしっぽ CO/アクセスログを描いてみよう のバックアップ差分(No.11)

* アクセスログを描いてみよう [#l6faed8e]
 
 gnuplot + unix 環境を使って [[ここ:http://www12.plala.or.jp/ksp/nocategory/access_day/index.html]] にあるようなアクセスログを描いてみましょう。
 
 ** 必要環境 [#o1cacba3]
 
 - gnuplot 4.0 (or later)
 - unix環境 (Cygwin や Linux などでも可)
 
 Cygwin を入れると gnuplot も入るので、Windows な人は Cygwin を入れて下さい。Cygwin 入手は [[ここ:http://cygwin.com/]] からどうぞ。
 フルインストール(全てのパッケージをインストールする)をお勧めします。
 
 ** データの入手 [#x71745ac]
 
 日ごとのアクセスログは以下の URL から入手できます。
 毎日深夜1時頃には前日分までのデータが更新されています。
 
 http://hooktail.maxwell.jp/data/daycount.log
 
 ダウンロードしたファイルをとりあえずプロットしてみましょう。
 ps ファイルに出力したいと思います。
 
  set term postscript eps enhanced colour
  
  set xlabel "date"
  set ylabel "access number"
  
  set output "01.eps"
  plot "daycount.log" using 1:2 notitle with lines lt 1 lw 3
 
 上記をファイル plot01.plt に保存して下さい。そして Cygwin 上から
 
  gnuplot plot01.plt
 
 と実行して下さい。01.eps というファイルができているはずです。
 ファイルには以下のようにプロットされています。
 
 &ref(01.png);
 
 データをプロットすることはできましたが、横軸が変ですね。
 これはデータファイルの第一列が「日付」ではなく「数値」として認識されているためです。
 
 日付として認識させるためには plot01.plt を以下のように変更します。
 
  set term postscript eps enhanced colour
 
  
  set xlabel "date"
  set ylabel "access number"
 
  
  set xdata time
  set timefmt "%Y%m%d"
  set format x "%m/%d(%a)"
 
  
  set output "02.eps"
  plot "daycount.log" using 1:2 notitle with lines lt 1 lw 3
トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Modified by 物理のかぎプロジェクト PukiWiki 1.4.6 Copyright © 2001-2005 PukiWiki Developers Team. License is GPL.
Based on "PukiWiki" 1.3 by yu-ji Powered by PHP 5.3.29 HTML convert time to 0.004 sec.