首先打印指定点,然后使用gnuplot从文件中打印数据

首先打印指定点,然后使用gnuplot从文件中打印数据,gnuplot,Gnuplot,我试图从两个来源绘制数据:(1)定义从(0,0)到(1,1)的对角线的特定点,以及(2)包含我分析的数据的文件。目前,我可以使用以下命令执行此操作: plot [0:1][0:1] 'sample.dat' using 1:2 with lines,\ '-' title 'random AUC=0.50' with lines dashtype 2 0 0 0 0 0.5 0.5 1 1 e 其输出如下: 但是,我希望首先显示对角线。如何实现这一点?如果要绘制对角线,只需绘制函数x 代码:

我试图从两个来源绘制数据:(1)定义从(0,0)到(1,1)的对角线的特定点,以及(2)包含我分析的数据的文件。目前,我可以使用以下命令执行此操作:

plot [0:1][0:1] 'sample.dat' using 1:2 with lines,\
'-' title 'random AUC=0.50' with lines dashtype 2
0 0
0 0
0.5 0.5
1 1
e
其输出如下:


但是,我希望首先显示对角线。如何实现这一点?

如果要绘制对角线,只需绘制函数
x

代码:

### plot order
reset session

set size square
set xrange[0:1]
set yrange[0:1]

# create some test data
set table $Data
    plot '+' u 1:(int($1*10+1.5)/10.) w table
unset table

set key top left

plot x with lines dt 2 title 'random AUC=0.50', \
    $Data u 1:2 w l ti 'sample AUC=0.596'
### end of code
添加:

### plot order
reset session

set size square
set xrange[0:1]
set yrange[0:1]

# create some test data
set table $Data
    plot '+' u 1:(int($1*10+1.5)/10.) w table
unset table

set key top left

plot x with lines dt 2 title 'random AUC=0.50', \
    $Data u 1:2 w l ti 'sample AUC=0.596'
### end of code
如果要打印任意点而不是
x

$myPoints <<EOD
0    0
0.1  0.2
0.5  0.7
1.0  1.0
EOD

plot $myPoints u 1:2 w lines

$myPoints二维绘图的元素总是按照您给定的顺序绘制,因此

绘图A、B
将首先绘制
A
,而
绘图B、A
将首先绘制
B

绘图f(x)适用于我的案例。然而,是否有比文件更通用的打印点解决方案?附录工作完美。谢谢