3

I am facing some trouble to make a simple plot. My .gnu file return an empty plot, like this :

I want a heat map, the format of my data is X Y Z in the .gnu file and the header is like this :

cat plot.gnu | head -n 10 :

set size square
set pm3d map corners2color c1
set xlabel ""
set ylabel ""
set yrange [   0.000:3003.000]
set xrange [   0.000:3003.000]
splot "-" with pm3d title "plot.gnu"
1.000 1.000 0
1.000 2.000 0
1.000 3.000 0

and the footer is like this :

cat plot.gnu | tail -n 10 

3002.000 2996.000 0
3002.000 2997.000 0
3002.000 2998.000 0
3002.000 2999.000 0
3002.000 3000.000 0
3002.000 3001.000 0
3002.000 3002.000 0

end
pause -1

EDIT : A shorter script could be :

set size square
set pm3d map corners2color c1
set xlabel ""
set ylabel ""
set yrange [   0.000:4.000]
set xrange [   0.000:4.000]
splot "-" with pm3d title "plot.gnu"
1.000 1.000 1
1.000 2.000 2
1.000 3.000 4
1.000 4.000 5
2.000 1.000 1
2.000 2.000 0
2.000 3.000 3
2.000 4.000 1
3.000 1.000 1
3.000 2.000 0
3.000 3.000 3
3.000 4.000 0
4.000 1.000 9
4.000 2.000 0
4.000 4.000 3
4.000 4.000 2

end
pause -1

Do you have an idea ? Thanks

4
  • Any warnings from gnuplot? Commented Sep 2, 2015 at 8:05
  • A guess: your data must contain an empty line whenever the first column changes its value. Commented Sep 2, 2015 at 8:20
  • No warning from gnuplot Commented Sep 2, 2015 at 8:22
  • Then you must give a short, but complete script which shows the problem and allows us to reproduce it, otherwise its all about guessing... Commented Sep 2, 2015 at 8:38

1 Answer 1

4

The short script gives the warning

Warning: Single isoline (scan) is not enough for a pm3d plot. Hint: Missing blank lines in the data file? See 'help pm3d' and FAQ.

And indeed, your data must be structured differently: isolines, i.e. parts with equal x-values (in your first column), must be separated by single empty lines:

set size square
set pm3d map corners2color c1
set autoscale xfix
set autoscale yfix
splot "-" with pm3d title "plot.gnu"
1.000 1.000 1
1.000 2.000 2
1.000 3.000 4
1.000 4.000 5

2.000 1.000 1
2.000 2.000 0
2.000 3.000 3
2.000 4.000 1

3.000 1.000 1
3.000 2.000 0
3.000 3.000 3
3.000 4.000 0

4.000 1.000 9
4.000 2.000 0
4.000 4.000 3
4.000 4.000 2
e
pause -1

enter image description here

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

5 Comments

Thanks, I think the real problem was the empty lines I forgot to add, this solved my problem. About the gnuplot warnings, this is strange I could not see any...
Indeed strange, that warning exists since almost forever. How do you run the script and which OS and gnuplot version do you have?
I am using Ubuntu 14.04 64-bits and gnuplot 4.0 patchlevel 0
Ok, so let's relativate "forever" ;) The warning appears since 4.2.0 (released 2007). Why do you still use 4.0.0? (released in 2004)? Ubuntu 14.04 ships 4.6.4
I should ask this to the informatic service of my laboratory xD... I am not working on my own machine, because it breaks the lab's rules. Also, I have no admin rights to change anything on the lab's machine. But thanks for all.

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.