2

When I plot with image in gnuplot, the label that I set is not displayed. Everything else is correct. Here is my code:

#! /bin/sh
#
# Plotting the color map of correlation using the default Matlab palette
#
gnuplot <<EOF
reset
set terminal pngcairo size 700,524 enhanced font 'Verdana,10'
unset key
# border
set style line 11 lc rgb '#808080' lt 1
set border 3 front ls 11
set tics nomirror out scale 0.75

set xrange [0:20]
set yrange [0:20]
set xlabel 'Distance x/D_j [-]'
set ylabel '{/Symbol t} u_j/D_j [-]'

# disable colorbar tics
set cbtics scale 0
# matlab palette colors
set palette defined ( 0 "#000090",\
                      1 "#000fff",\
                      2 "#0090ff",\
                      3 "#0fffee",\
                      4 "#90ff70",\
                      5 "#ffee00",\
                      6 "#ff7000",\
                      7 "#ee0000",\
                      8 "#7f0000")

set output 'test.png'
set label 'aaa' at 2,17
plot 'Cuup_nf_a090_r050Dj_average' u 1:2:3 with image
EOF

What is strange is: if I plot the data file using a column which doesn't exist as the third data series, for example:

plot 'Cuup_nf_a090_r050Dj_average' u 1:2:4 with image

(I have only 3 columns in the file 'Cuup_nf_a090_r050Dj_average')

Sure, I get only blank (no data) in my image, but the label is displayed correctly.

So it seems that the label is covered by my data palette... I have tried to put 'set label' at the end of code, but it doesn't work either.

Does someone have an idea?

ps: my gnuplot version: Version 4.6 patchlevel 4

Thanks a lot in advance.

1
  • 1
    Use set label front ... Commented May 23, 2017 at 16:33

1 Answer 1

3

Labels have an option front|back to position them on the front or back layer. Default setting is back, so that labels not specifying an explicit layer are hidden when plotting with image:

$data <<EOD 
1 2
3 4
EOD
set label 'default, hidden' at graph 0.6, graph 0.7 font ",20"
set label back 'back, hidden' at graph 0.6, graph 0.5  font ",20"
set label front 'front, visible' at graph 0.6, graph 0.3 font ",20"

plot $data matrix with image

enter image description here

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

1 Comment

Thank you so much! It saved me... (ps. I should have read more lines in the tutorial...)

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.