1つのグラフに複数のチャートを描くには?

1つのグラフに複数のチャートを描くには?

私のデータ値の座標が同じ同じプロットに複数のグラフを描くプロットスクリプトが必要ですx。これにより、プロットの各変数の違いが表示されます。スプレッドシートを使用してプロットしようとしましたが、プロットは互いに明確に識別されません。私のデータは次のとおりです。

x y1 y2 y3 y4 

1 10 25 28 30 
2 20 15 40 20 
3 10 10 30 20 
4 2 5 15 30    
. . . . 

ベストアンサー1

すべてのデータをというファイルに保存すると仮定すると、data.txt一般的なGnuPlotスクリプトには次のものが含まれます。

# Set the output file type
set terminal postscript eps enhanced color solid colortext 9
# Set the output file name
set output 'multiple_plots.eps'

# Now plot the data with lines and points
plot 'data.txt' using 1:2 w lp title 'y1', \
     '' using 1:3 w lp title 'y2', \
     '' using 1:4 w lp title 'y3', \
     '' using 1:4 w lp title 'y4'

上記のコードをファイル(たとえば)に保存plot.gpし、次のようにGnuPlotを使用して実行できます。

gnuplot plot.gp

よりGnuPlotウェブサイト詳細と多数のデモスクリプトをご覧ください。

おすすめ記事