2

I am plotting data series with gnuplot with command:

p 'file.txt' u 1:2:3 with labels

and got the graph with a lot of labels as below

enter image description here

which looks messy. So, i use different command:

p 'file.txt' u 1:2:3 with points pt 5 palette

which showed beautiful graph with colour spectrum. enter image description here

But it did not show the labels. Acutally I don't need to show all labels, but I would like to show lowest five and highest five values.

How can I mix these two commands so that I can show the graph with colour spectrum with 10 labels (5 for lowest five and another 5 for highest five). Thanks.

1 Answer 1

3

The labels style accepts a tc palette option

Thus you can do

plot datafile u 1:2:3:3 with labels tc palette

For example, with the following data

1 1 30
1 2 40
2 2 30
2 1 35
3 3 10
3 4 15

using plot datafile u 1:2:3:3 with labels tc palette will plot

enter image description here

In order to filter to only the top 5 and bottom 5 numbers, you will need to do some pre-processing of your data outside of gnuplot.

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

2 Comments

hi thanks, but when i use that command, it showed "not enough columns for variable colour". Why it is happening?
Make sure that you are giving 4 columns as in my command, and not just 3. Notice that I repeated the 3rd column.

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.