1

I'm running into a strange issue when generating a plot using gnuplot (version 6.0 patchlevel 1, on Microsoft Windows version 10.0.19045.5737). To my plot I need the colorbox to appear inverted, i.e., the color gradient should go from high values at the bottom to low values at the top.

I noticed that when using certain terminals, the colorbox appears completely blank or white, without the expected color gradient:

  1. wxt, success
  2. emf, success
  3. pngcairo, success
  4. svg, success
  5. pdfcairo, FAIL
  6. epscairo, FAIL

I’ve attached sample images:

output from pngcairo terminal

output from pngcairo terminal

output from pdfcairo terminal

output from pdfcairo terminal

Output using "Export plot to file" option as pdf from wxt interactive window.

pdf from wxt interactive window

Here's a simplified version of the script I'm using:

reset session
set encoding utf8

#set terminal wxt size 800,400 font "Arial,9"

#set terminal pngcairo size 800,400 font "Arial,9"
#set output "diagram.png"

set terminal pdfcairo size 10,5 in font "Arial,14"
set output "diagram.pdf"

set tics out nomirror
unset key
set style circle radius graph 0.01
set style fill transparent solid 1 border lc ls -1
set palette viridis maxcolors 25
set xrange [400:450]
set yrange [100:600]
set xlabel "Temperature/°C"
set ylabel "Index"
set cblabel "Depth (m)"
set cbtics offset -1,0

set multiplot layout 1,2

set title "normal colorbox"
plot "data.txt" u 2:3:1 w circle lc palette

set colorbox invert
set title "inverted colorbox"
replot

unset multiplot
unset output

The data.txt looks something like this:

Depth   Temp    Index
201.05  427.34  251.70
205.24  431.39  296.30
209.24  414.27  185.66
211.89  432.81  140.98
215.54  413.30  299.13
217.17  424.50  272.27
221.00  426.93  184.91
221.50  420.06  241.14
222.95  420.16  467.74
223.60  410.67  196.70
226.39  416.30  166.96
228.87  430.30  437.81
232.22  415.00  343.18
232.23  415.76  494.67
235.17  410.02  224.60
238.31  429.06  302.89
238.37  414.77  367.09
238.49  421.26  195.13
239.36  414.16  161.46
241.46  418.85  263.24
242.76  431.97  378.32
243.17  420.91  154.06
246.77  421.16  135.39
247.30  414.63  411.32
248.97  410.22  146.30

There is some wrong with my script/data or this is a bug?

2
  • I can reproduce the problem using current gnuplot, and add qt(FAIL) tikz(success). But for me eps does not fail. Did you use something ofther than "set term postscript color eps"? Commented Apr 25 at 16:49
  • Actually I just run set term eps command. Taking a second look on manual seems to be this terminal does not exists. According the header of generated eps file seems the set term eps commando is a shortcut to set term epscairo. When I use set term postscript eps — just you did — the plot is fine. I've notice that the script runs fine under version 6.0 patchlevel rc1. Commented Apr 25 at 17:28

2 Answers 2

2

I can confirm the reported problem and traced it to commit 84e724843f (applied between 6.0-rc1 and 6.0-rc2). This bug should only affect the qt and cairo terminals. The fix is straightforward, but unfortunately I don't see a work-around for it in the current 6.0.2 release. It has been fixed in 6.0.3

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

Comments

1

Just for fun, here is a workaround for 6.0.x versions, which works also for qt and pdfcairo terminals, however, at the cost of losing autoscale. What you can do is:

  • invert the palette via set palette negative
  • set the cbrange and cbtics (semi-)manually
  • mirror the data in the cbrange

Script:

### invert colorbox for qt,pdfcairo terminal in gnuplot 6.0.x
reset session

# create some random test data
set table $Data
    plot '+' u (rand(0)*50+400):(rand(0)*500+100):(rand(0)*50+200) w table
unset table

set xrange[400:450]
set yrange[100:600]
set key noautotitle
set palette viridis maxcolors 25
set palette negative

cbmin  = 200
cbmax  = 250
cbstep = 10
set cbrange [cbmin:cbmax]
set for [i=0:(cbmax-cbmin)/cbstep] cbtics add (sprintf("%g",cbmax-i*cbstep) cbmin+i*cbstep)
mirror(col) = cbmax + cbmin - column(col)

plot $Data u 1:2:(mirror(3)) w p pt 7 lc palette
### end of script

Result: (from gnuplot 6.0.2 and qt terminal)

enter image description here

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.