Reputation: 127
I am trying to plot data from two sources: (1) specific points that define a diagonal from (0, 0) to (1, 1), and (2) file containing my analyzed data. Currently, I can do this using the following command:
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
which outputs the following:
However, I want the diagonal line to appear first. How can I achieve this?
Upvotes: 1
Views: 528
Reputation: 15093
The elements of a 2D plots are always drawn in the order you give them, so
plot A,B
will draw A
first, and plot B,A
will draw B
first.
Upvotes: 1
Reputation: 25714
If you want to plot the diagonal, simply plot the function x
.
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
Addition:
If you want to plot arbitrary points instead of 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
Result:
Upvotes: 1