gnuplot中的自动系列?

gnuplot中的自动系列?,gnuplot,Gnuplot,我的意见如下: year s1 s2 s3 2000 1 2 3 2001 2 4 6 2002 4 8 12 我不知道有多少个系列。今天是3点,明天可能是4点 我想把它画成一个多系列的图表。大概是这样的: set key autotitle columnhead plot 'data/chart-year-subreddit-count' using 1:2 with lines, \ 'data/chart-year-subreddi

我的意见如下:

year   s1   s2  s3
2000   1    2   3 
2001   2    4   6 
2002   4    8   12
我不知道有多少个系列。今天是3点,明天可能是4点

我想把它画成一个多系列的图表。大概是这样的:

set key autotitle columnhead
plot 'data/chart-year-subreddit-count' using 1:2 with lines, \
'data/chart-year-subreddit-count' using 1:3 with lines, \
'data/chart-year-subreddit-count' using 1:4 with lines
除了因为我不知道有多少列之外,我不知道在我的gnuplot脚本中放什么


我需要写脚本来写文件吗?或者gnuplot能否自动计算出有多少个系列?

gnuplot本身无法计算列数,但您可以使用例如
wc
head
来计算列数:

file = 'data/chart-year-subreddit-count'
cols = int(system('head -1 '.file.' | wc -w'))
plot for [i=2:cols] file using 1:i with lines

太不可思议了。非常感谢。如果我能提供多个更新,我会的。