gnuplot / legend
not so FAQ
|
凡例(Legend)あれこれ でもなんで,keyなんて呼ぶんだろう....
凡例を消したい.2つの方法があります.一つは, gnuplot> set nokey とする方法で,凡例は全部消えます.もう一つは,plotする際に notitle gnuplot> plot f(x) notitle, "file.dat" title "data" 凡例の表示場所を変えたい.標準では,凡例は右上に表示されます.これを変えるには gnuplot> set key left bottom とすると,左下になります.指定できるオプションは,次の通りです.
幾つかのものは組み合わせて指定できます.outside bottomなら, 凡例を表示する座標を, 直接指定することもできます. gnuplot> set key 100,100 なら,(X,Y)=(100,100)の位置に表示されます.一つ目の凡例の, 凡例の中の誤差棒を消したい. 誤差付きのデータをプロットすると,凡例中の記号にも誤差棒が付きます 次のデータ(test.dat)をプロットする場合を考えます. # X Y Y-error 1.0 1.2 0.2 2.0 1.8 0.3 3.0 1.6 0.2 これをプロットすると, gnuplot> set xrange [0:4] gnuplot> set yrange [0:3] gnuplot> plot "test.dat" usi 1:2:3 title "data" w yerrorbars ![]() この様に,凡例中の誤差棒は横向きになってしまいます. gnuplot> set xrange [0:4] gnuplot> set yrange [0:3] gnuplot> plot "test.dat" usi 1:2:3 notitle w yerrorbars 1, "test.dat" usi 1:2 title "data" w points 1 なんてやると,誤差棒は消えます. ![]() テキスト中にポストスクリプトの記号を使うと,表示位置がおかしくなる. 凡例の中のテキスト(plotコマンドのtitleオプションで付けられるもの) 行間隔を調整する. 凡例の行間隔は, set key spacing で変えられます.行間隔を1.5倍 凡例に枠を付ける. 凡例に枠を付けるには, set key box とします.枠の線種は,グラフの gnuplot> set linestyle 1 lt 2 lw 3 gnuplot> set key box linestyle 1 gnuplot ver.4.0の場合は以下のようにします. gnuplot> set style line 1 lt 2 lw 3 gnuplot> set key box linestyle 1 |