y軸を2軸表示する方法です.細かい好みの設定込みです.
line colorは赤(1)・緑(2)にするより,赤(1)・青(3)にする方が良いです(色盲の人に配慮して).
$ set ytics nomirror
$ set y2tics
$ set xlabel "{/=30 xlable}"
$ set ylabel "{/=30 ylable}"
$ set y2label "{/=30 y2label}"
$ set logscale x
$ set xrange [x1:x2]
$ set yrange [y11:y12]
$ set y2range [y21:y22]
$ p "./file.txt" u 1:2 w linespoints lt 1 lc 1 lw 4 pt 1 ps 3 title "title", "./file.txt" u 1:3 w lp lt 1 lc 3 lw 4 pt2 ps 3 title "title2" axes x1y2
タイトルの内容で重要なのは1,2行目と最後の行の最尾です.
2015年8月27日木曜日
2014年6月7日土曜日
gnuplotで棒グラフを描く
gnuplotで棒グラフを描くコマンドです.棒グラフなのでx軸は数値ではなく項目という設定で行います.データの形式を
「項目 数値」
とします.
$ set style fill solid
$ set boxwidth 0.5
$ plot [-0.5:n+0.5][:] "data.txt" using 0:2:xtic(1) with boxes notitle
一行目は棒グラフの塗りつぶしを指定します.
二行目は棒グラフの幅を指定します.1だと隣の項目と接してしまい見辛いかと思います.
三行目がプロットです.x軸の表示を±0.5しておくと見やすいです.xtic(1)でx軸の項目名をデータの一列目に指定します.with boxesが棒グラフの指定です.
2014年6月5日木曜日
Gnuplotで指定範囲の背景を塗りつぶす
グラフを描く時に,y軸方向にこの範囲に数値が入っていれば良い,ということを伝える為に,グラフの指定範囲の背景に色を入れる.方法としてはその範囲に長方形オブジェクトを配置する.
$ set object 1 rect from graph 始点x, graph 始点y to graph 終点x, graph 終点y back linewidth 0 fillcolor rgb "cyan" fill solid 0.5
“set object 1 rect” で長方形の指定
“from graph 始点x, graph 始点y” で長方形の左下の頂点を指定
“to graph 終点x, graph 終点y” で長方形の右上の頂点を指定
頂点の指定はグラフ中の割合で行う.
“back” で背面に配置
“linewidth 0” は辺の線幅を指定
“fillcolor rgb "cyan"” で色指定
“fill solid 0.5” で透明度の指定
$ set object 1 rect from graph 始点x, graph 始点y to graph 終点x, graph 終点y back linewidth 0 fillcolor rgb "cyan" fill solid 0.5
“set object 1 rect” で長方形の指定
“from graph 始点x, graph 始点y” で長方形の左下の頂点を指定
“to graph 終点x, graph 終点y” で長方形の右上の頂点を指定
頂点の指定はグラフ中の割合で行う.
“back” で背面に配置
“linewidth 0” は辺の線幅を指定
“fillcolor rgb "cyan"” で色指定
“fill solid 0.5” で透明度の指定
2014年1月6日月曜日
歩行段階の英語表記
歩行段階(Stage of gait)の英語表記について.
立脚相:Stance phase
足接地:Foot strike (contact) または 踵接地:Heel strike (contact)
足底接地期:Foot flat または 荷重期:Loading
立脚中期:Mid stance
立脚終期:Terminal stance
前遊脚期:Pre swing
遊脚相:Swing phase
遊脚初期:Initial swing
遊脚中期:Mid swing
遊脚終期:Terminal swing
立脚相:Stance phase
足接地:Foot strike (contact) または 踵接地:Heel strike (contact)
足底接地期:Foot flat または 荷重期:Loading
立脚中期:Mid stance
立脚終期:Terminal stance
前遊脚期:Pre swing
遊脚相:Swing phase
遊脚初期:Initial swing
遊脚中期:Mid swing
遊脚終期:Terminal swing
2013年12月25日水曜日
Gnuplotのグラフ中の表示サイズを変更する
Gnuplotで点の大きさや線の太さ,文字表示を変更する方法に付いて.
点や線はwith(w)以降に…
pointsize(ps) ?:点の大きさ
pointtype(pt) ?:点の種類
linewidth(lw) ?:線の幅
linetype(lt) ?:線の種類
linecolor(lc) ?:線の色
(?には数字)
軸ラベルなどの変更はeps出力のときに行います.
まずラベルでは
% set xlable "{/=30 label}"
とすると30のフォントサイズになります.
次にeps出力のterminal設定で,
% set terminal postscript eps color enhanced "Arial" 25
enhancedは拡張設定,Arialの部分に好みのフォントを,25にフォントサイズを代入します.
ちなみにこのterminal設定では,全体の出力サイズがA4みたいですね.
点や線はwith(w)以降に…
pointsize(ps) ?:点の大きさ
pointtype(pt) ?:点の種類
linewidth(lw) ?:線の幅
linetype(lt) ?:線の種類
linecolor(lc) ?:線の色
(?には数字)
軸ラベルなどの変更はeps出力のときに行います.
まずラベルでは
% set xlable "{/=30 label}"
とすると30のフォントサイズになります.
次にeps出力のterminal設定で,
% set terminal postscript eps color enhanced "Arial" 25
enhancedは拡張設定,Arialの部分に好みのフォントを,25にフォントサイズを代入します.
ちなみにこのterminal設定では,全体の出力サイズがA4みたいですね.
2013年12月19日木曜日
Gnuplotでeps出力する
よく使うはずなのに忘れがちなGnuplotのeps出力.さらっと行きます.
% set terminal postscript eps color
% set output "output.eps"
% replot
% set terminal wxt
replotでは最後に行ったplotを呼び出します.
% set terminal postscript eps color
% set output "output.eps"
% replot
% set terminal wxt
replotでは最後に行ったplotを呼び出します.
Gnuplotで標準偏差付き点グラフを描く
グラフを書くならGnuplot.Excelなんてもってのほか.Gnuplotが美しい.
しかし,Gnuplotはコマンド打ち込みだから知らない機能だらけで,調べても忘れてしまうことが多いです.
本エントリは標準偏差(Error bar)の付け方について.
まずデータファイルhogehoge.txtの構成は
x1 y1 標準偏差1
x2 y2 標準偏差2
…
とします.
Gnuplotで
% p "hogehoge.txt" u 1:2:3 w e
です.省略形を使わないと
% plot "hogehoge.txt" using 1:2:3 with errorbar
です.errorbarのところは
errorbar
errorbars
yerrorbar
yerrorbars
でも可能です.xerrorbarにするとx軸方向のError barが付きます.
しかし,上記のコマンドでは点が - で見にくいです.そこで,
% p "hogehoge.txt" u 1:2:3 w e pt 6
にします.省略無しは
% plot "hogehoge.txt" using 1:2:3 with errorbar pointtype 6
です.point type 6では○が点に使われます.2だと×,5だと■など,数字を帰ることで点の形を選べます.
また,Error barの横線が短くて見づらい場合は
% set bars 5
などとすれば良いです.
以上.
しかし,Gnuplotはコマンド打ち込みだから知らない機能だらけで,調べても忘れてしまうことが多いです.
本エントリは標準偏差(Error bar)の付け方について.
まずデータファイルhogehoge.txtの構成は
x1 y1 標準偏差1
x2 y2 標準偏差2
…
とします.
Gnuplotで
% p "hogehoge.txt" u 1:2:3 w e
です.省略形を使わないと
% plot "hogehoge.txt" using 1:2:3 with errorbar
です.errorbarのところは
errorbar
errorbars
yerrorbar
yerrorbars
でも可能です.xerrorbarにするとx軸方向のError barが付きます.
しかし,上記のコマンドでは点が - で見にくいです.そこで,
% p "hogehoge.txt" u 1:2:3 w e pt 6
にします.省略無しは
% plot "hogehoge.txt" using 1:2:3 with errorbar pointtype 6
です.point type 6では○が点に使われます.2だと×,5だと■など,数字を帰ることで点の形を選べます.
また,Error barの横線が短くて見づらい場合は
% set bars 5
などとすれば良いです.
以上.
登録:
投稿 (Atom)