gnuplot で点の座標を直接指定する

gnuplot では、テキストファイルからデータを読み込んでグラフを表示することが一般的だけど、直接座標を指定したいこともある。
その場合は

plot "-"

と入力すればよい。
後に続けて、x座標とy座標をカンマで区切って入力する。(カンマの次に半角空白を入れないと正しく結果がでない)
入力が終わったら e を入力する。
例えば、次のような感じ

gnuplot> set size square
gnuplot> set xrange [0:10]
gnuplot> set yrange [0:10]
gnuplot> plot "-"
input data ('e' ends) > 2, 3
input data ('e' ends) > 5, 8
input data ('e' ends) > 7, 9
input data ('e' ends) > e

すると次のような結果を得られる。

(右上の点は凡例であってプロットされた点ではない。)

他のグラフと一緒に表示するには、通常通りカンマで区切ればいい。

gnuplot> plot "-", x*x
input data ('e' ends) > 2, 3
input data ('e' ends) > 5, 8
input data ('e' ends) > 7, 9
input data ('e' ends) > e


gnuplotの精義―フリーの高機能グラフ作成ツールを使いこなす

gnuplotの精義―フリーの高機能グラフ作成ツールを使いこなす