来自 header 评论的 gnuplot 自动标题矩阵
gnuplot autotitle matrix from header comment
如果我有带有 header 注释的矩阵数据,我可以将其用作标题吗?数据类似于:
# Information on my plot, the time (t=2.0), for example
1 2 3 4
5 6 7 8
9 0 9 8
7 6 5 4
我试过set key autotitle columheader
尝试使用整个注释行作为标题,但没有打印标题。
此外,对于同一文件中的多个数据集,如何实现这一点?
是的。
来自文档(在 "help index" 下)
`index '<name>'` selects the data set with name '<name>'. Names are assigned
to data sets in comment lines. The comment character and leading white space
are removed from the comment line. If the resulting line starts with <name>,
the following data set is now named <name> and can be selected.
Example:
plot 'file' index 'Population'
Please note that every comment that starts with <name> will name the following
data set. To avoid problems it may be useful to choose a naming scheme like
'== Population ==' or '[Population]'.
这是一个演示
$DATA << EOD
# Ones
0 1
1 0
#Twos
0 2
2 0
#Threes
0 3
3 0
EOD
set view 77, 330
set ztics 1
set hidden3d nooffset
set key box
splot for [name in "Ones Threes Twos"] \
$DATA index name matrix with lines lw 3 title name
如果我有带有 header 注释的矩阵数据,我可以将其用作标题吗?数据类似于:
# Information on my plot, the time (t=2.0), for example
1 2 3 4
5 6 7 8
9 0 9 8
7 6 5 4
我试过set key autotitle columheader
尝试使用整个注释行作为标题,但没有打印标题。
此外,对于同一文件中的多个数据集,如何实现这一点?
是的。 来自文档(在 "help index" 下)
`index '<name>'` selects the data set with name '<name>'. Names are assigned
to data sets in comment lines. The comment character and leading white space
are removed from the comment line. If the resulting line starts with <name>,
the following data set is now named <name> and can be selected.
Example:
plot 'file' index 'Population'
Please note that every comment that starts with <name> will name the following
data set. To avoid problems it may be useful to choose a naming scheme like
'== Population ==' or '[Population]'.
这是一个演示
$DATA << EOD
# Ones
0 1
1 0
#Twos
0 2
2 0
#Threes
0 3
3 0
EOD
set view 77, 330
set ztics 1
set hidden3d nooffset
set key box
splot for [name in "Ones Threes Twos"] \
$DATA index name matrix with lines lw 3 title name