# t x y 0.1 2 3 0.2 3 4 0.3 4 5 0.4 6 7 0.5 2 4のテキストファイルとします。 #が先頭にあるとコメント行になります。 数値と数値の間は空白スペースでもtabでも構いません。
set datafile separator ","または
plot 'hoge.csv' using '%lf,%lf'としてください。タブの時は\t
plot 'd' using 1:3とすると1列目(x軸)と3列目(y軸)のデータを使って描画します。
plot 'd' using 1:3 with linesとします。
plot 'd' using 1:3 with linespointsとします。
plot 'd' using 1:3 withでEnterキーを押してください。 候補がたくさん出てきます。
plot 'd' using 1:2 , 'd' using 1:3 with lines
set xlabel 'time' set ylabel 'output'などとします。
set nokeyとします。 set key で再設定できます。
setでEnterキーを押してみてください。 set で設定できる候補がたくさん出てきます
plot 'd' title 'hogehoge' with linesとします。
set xrange[最小値:最大値] set yrange[最小値:最大値]などとします。
set multiplot
set origin 0,0.5 ##左 0 上0.5 の位置
set size 0.5でx,y軸両方向共通に縮小されます。
set scize x_sacle, y_scaleで x,y 方向別サイズに縮小できます。 たとえば
set multiplot set origin 0,0.5 set size 1,0.5 plot 'd' using 1:2 set origin 0,0 plot 'd' using 1:3 with linesとしたらたて並びで表示できます。
set output 'hoge.eps'注意: このときの出力先のディレクトリ(フォルダ)はgnuplotが起動された時の、 カレントディレクトリです。
set output '保存先フルパス\hoge.eps'とするか、
cd '保存先バス' set output 'hoge.eps'としましょう
set terminal postscript eps color
replot画面上にはなにも現れません。outputで設定したファイルに直接書き込まれます。
set terminal windowsgnuplotを終了したら、 illustratorなどで拝むことができます。
set outputとします。(output先を指定しない)
unset output
pause -1 pause 1 pause 秒数-1はEnter Keyが押されるまでPauseするそうです。
さて、こんなことをgnuplotの画面上で毎回行っていては非効率です。
以上のスクリプトをまとめてしまいましょう。
set xlabel 'time' set ylabel 'output' plot 'd' using 1:2, 'd' using 1:3 with lines set output 'hoge.eps' set terminal postscript eps color replot set terminal windows set outputとしたものをファイル名をつけて保存してください。 fugaとします。 フォルダを指定した後 load 'fuga'とすると 一発です。 途中デバッグするなら先頭に#をつけるだけです。(コメント扱いになります) 最後のset outputとすることで、ファイルを開放するので、 gnuplotを起動したままgvなどでの図面の描画が出来ます。 |
set terminal svg set output 'hoge.svg'として、出力後、ターミナル上で
inkscape -z (-f) hoge.svg -E hoge.epsとしてください。-zはコンソールでのファイル処理だけを扱う。 -fは指定したドキュメントでなくても良いようです。
set terminal svg set multiplotと、multiplotを呼び出す前に、terminalを変えておいた方が良いようです。
set stlye line nとすることで n番目の線の種類を指定する事ができます。
set style line n lt m lc color lw kとすることで、 n番目の線種を、ラインタイプ(lt)をn,色(lc)をcolor,太さ(lw)をk に設定できます。
rgbcolor 'red'とする方法でしょうか。
rgbcolor '#808000' # olive rgbcolor '#00ffff' # aqua rgbcolor '#800000' # maroon
plot 'd' using 1:2 w l lw 2などのように、lw,lcを直接設定すればいいようです。
plot 'd' using 1:2 w l ls 2のようにlsで指定します。
set terminal postscript eps color "Times-Roman,40"などとします。
set xlabel 'hoge' font "Times-Italic,28"のように、オプションとして、font "hoge,size"として指定します。
unset style line
set datafile separator "," set grid set style line 1 lt 1 lc rgbcolor 'red' lw 4 set style line 2 lt 1 lc rgbcolor 'green' lw 4 set style line 3 lt 1 lc rgbcolor 'blue' lw 1 #細くする #set xrange [0:50] #set yrange [-1:1] set title 'read_file' font "Times-Roman,32" set ylabel 'input' font "Times-Italic,28" set xlabel 'time s' font "Times-Italic,28" plot 'read_file' using 1:2 w l ls 1 title 'u', 'read_file' using 1:3 with lines ls 2 title 'u2','read_file' using 1:3 w l ls 3 title 'aim' set output 'read_file-input.eps' set terminal postscript eps color "Times-Roman,24" replot set terminal windows set output unset grid set title set autoscale unset size unset style line |
#!/bin/bash #template.plt 中のread_fileの部分をfuga.*に置き換える # for i in fuga.* ; do sed "s/read_file/$i/g" template.gplt > $i.plt echo $i doneディレクトリ中にfuga.*というファイルがあれば、上記スクリプト中の read_fileの部分をfuga.*と置き換えた、gnuplot用スクリプトが出来ます。