4

I have a data like this in a file.dat

2 2
5 5
7 3

100 102
130 80
116 134

-40 -100
-50 -60
-61 -58

I would want to plot each block in different color,

There is no restriction that a specific color, but just some visually different color.

I tried with linetype like this:

for [IDX=0:2] 'file.dat' i IDX u 1:2 with linespoints linetype IDX

it plots all the blocks with different color and obviously only last one is visible.

So what is the right way to do this?

0

1 Answer 1

6

That is the right way, but you must have two blank lines in order to access different blocks with index.

And, you should start at linetype 1, because linetype 0 is a special linetype for the grid lines:

2 2
5 5
7 3


100 102
130 80
116 134


-40 -100
-50 -60
-61 -58

And the plot command

plot for [IDX=0:2] 'file.dat' index IDX u 1:2 with lp lt IDX+1
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, how I have to change the command for plotting all the block if I don't know how many block I have? thanks
@thewoz Use stats to calculate the number of blocks, I think the result is stored in variable STATS_blocks

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.