0

Here is my data file

 seconds        data
 (x-axis       ( y axis
  points)      points)
3.880000,       20
3.920000,       10
3.960000,       20
4.000000,       20
4.080000,       20
4.120000,       20
4.570000,       20
4.620000,       10
4.650000,       10
4.690000,       10
4.750000,       20
 .
 .
 .
and so on

I want to plot points in column 2 at positions specified by column 1

ie I want 20 , 10 , 20 20, 20 etc to be present at 3.88 , 3.92, 3.96 on xaxis

Can anybody tell me how to do this ?

2 Answers 2

4

Suppose your data is in 1.txt:

plot "1.txt" using 1:2

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

Comments

4

I know it's been a long time, but for anyone else who stumbles upon this... For this datafile, you'll also need a set datafile separator ','

e.g.

set datafile separator ','
plot 'data.dat' using 1:2

As a matter of style, it is probably best practice to explicitly comment out the header of the datafile using '#' characters. e.g.

# seconds        data
# (x-axis       ( y axis
#  points)        points)
3.880000,       20
3.920000,       10
3.960000,       20
4.000000,       20
4.080000,       20
4.120000,       20
4.570000,       20
4.620000,       10
4.650000,       10
4.690000,       10
4.750000,       20

For this simple example, it works without the comments, but other, more complicated datafiles may not.

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.