gnuplot / plot (1)
not so FAQ
|
2次元プロットのあれこれ (その1)図の大きさがいつも一定になるようにしたい.gnuplotが描くグラフの領域は,軸の数字やラベルによって変化します. gnuplot> show margin lmargin is computed automatically bmargin is computed automatically rmargin is computed automatically tmargin is computed automatically で見ることができます.marginに与える数値は,文字数です. 例として全てのmarginを指定した場合を示します. gnuplot> set lmargin 10 gnuplot> set bmargin 3 gnuplot> set rmargin 2 gnuplot> set tmargin 1 この様にしておいて,X,Y軸の目盛のフォーマットを変えてみます. ![]() ![]() 軸のラベルの位置は変わってしまいましたが,グラフの枠の大きさは 左右両方のY軸を使いたい.複数の図を一つにまとめて描きたいときが良くあります.gnuplotでは上下 Y2軸は,何もしなければ左側のY軸と同じです.Y2のレンジをYと違うように gnuplot> set xrange [0:2*pi] gnuplot> set yrange [-1:1] gnuplot> set y2range [0:1] gnuplot> plot sin(x) axis x1y1, sin(x)**2 axis x1y2 ![]() このままでは,右の軸に描かれる目盛は,左の軸と同じままです.0〜1の gnuplot> set y2tics 0, 0.2 gnuplot> set ytics nomirror このようにしてプロットした図では,どの線を右の軸で読むのかをはっきりと 軸を消したい. gnuplotは上下左右に枠を作って,その中に図をプロットしますが,この gnuplot> set border 3 gnuplot> set xtics nomirror gnuplot> set ytics nomirror ![]() 正方形や,縦横比の固定された長方形の図を描きたい.昔のgnuplotでは不可能の一つとして有名でしたが,今ではサポートされて gnuplot> set size square 同様に,縦横比を固定するには,次のようにします. gnuplot> set size ratio 2 この場合,Y軸がX軸の2倍になります.squreやratioで指定する軸の長さ
|