首先绘制指定点,然后使用 gnuplot 绘制文件中的数据
Plot specified points first then data from file using 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
。
代码:
### 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(*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
结果:
二维绘图的元素总是按照您指定的顺序绘制,所以
plot A,B
先画A
,plot B,A
先画B
。
我正在尝试绘制来自两个来源的数据:(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(*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
结果:
二维绘图的元素总是按照您指定的顺序绘制,所以
plot A,B
先画A
,plot B,A
先画B
。