2

I have a text file as follows:

ls 10
cd 5
cut 12
awk 7
...

I would like to plot it using gnuplot with the text column as the X axis:

plot 'data.txt' u 1:2

But I get this error:

         warning: Skipping data file with no valid points
                         ^
         x range is invalid

2 Answers 2

6
$data << EOD
ls 10
cd 5
cut 12
awk 7
EOD

# this is all just plot layout stuff; customize to taste
unset border
set tics scale 0
set xzeroaxis
set title "x coord = line number"

# use line number for x coordinate, column 1 for tic label
plot $data using 0:2:xticlabel(1) with impulse

enter image description here

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

Comments

2

Check help xticlabels. And try this:

reset session

$Data <<EOD
ls 10
cd 5
cut 12
awk 7
...  9
EOD

set boxwidth 0.7
set style fill solid 1.0
set yrange[0:]

plot $Data u 2:xtic(1) w boxes

Comments

Your Answer

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