gnuplotで日本語を表示

フォントを指定すると日本語を表示できる。ただ、文字化けすることもある。

gnuplot> set terminal emf color "Ryumin-Light-EUC-H" 20
gnuplot> set output "test.emf"
gnuplot> set xlabel "横軸" font "Ryumin-Light-EUC-H"
gnuplot> set ylabel "縦軸" font "Ryumin-Light-EUC-H"
gnuplot> set xrange [-10:10]
gnuplot> set yrange [-20:20]
gnuplot> set title "タイトル" font "Ryumin-Light-EUC-H"
gnuplot> plot exp(x) title "プロット1", x**2 title "プロット2"

得られたtest.emfに関して、表示するソフトによっては背景が真っ黒になってしまったり、読み込みができなかったりするが原因は不明。

gnuplotで時系列データをプロット

sobasobasoba2009-12-12

以下の時系列データをgnuplotでグラフにする。

12 2009/11/02 12:00
32 2009/11/02 12:10
43 2009/11/02 12:20
28 2009/11/02 12:30
4 2009/11/02 12:40
9 2009/11/02 12:50
37 2009/11/02 13:00
10 2009/11/02 13:10
22 2009/11/02 13:20
34 2009/11/02 13:30
57 2009/11/02 13:40
84 2009/11/02 13:50
48 2009/11/02 14:00

以下のとおりにするとプロットができる。出力形式などは適宜変えること。

gnuplot> set terminal png
gnuplot> set output "test.png"
gnuplot> set xdata time
gnuplot> set timefmt "%Y/%m/%d %H:%M"     # 入力先の形式
gnuplot> set format x "%H:%M"             # 出力先の形式
gnuplot> plot "input.txt" using 2:1 with lines