1

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:

sample AUC plot

However, I want the diagonal line to appear first. How can I achieve this?

2 Answers 2

1

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:

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Plotting f(x) works for my case. However, is there a more general solution to plot points then file(s)?
Late comment, but the addendum is just what I needed. Thanks!
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.