Key becomes invisible in pm3d gnuplot

2020-04-11 10:29发布

问题:

I am using following code to draw a graph in gnuplot using pm3d map:

set pm3d map
set pm3d corners2color c1
spl 'patternD0pt02.dat' title "(a)"

But when the plot is generated, the title "(a)", which otherwise should have appeared in the top right corner, becomes invisible (or hides behind the plot). Is there any way to make this key/title visible?

Thanks in advance

回答1:

Indeed, the title is hidden behind the surface and there is no option set key front. This is a bug in 4.6. and is fixed in 5.0.

You can workaround by placing a normal label, since the title of a pm3d plot doesn't plot a sample item. Putting a white rectangle behind the lable is a bit tricky:

set label center at graph 0.95,0.95 front '(a)'
set object rectangle front at graph 0.95,0.95 size char 5,2 fc rgb 'white' fillstyle solid noborder

A full, working example is:

set terminal pngcairo size 800,600
set output 'foobar.png'

set xrange [0:10]
set yrange [0:10]
set samples 20
set isosamples 20

set pm3d map

set label center at graph 0.95,0.95 front '(a)'
set object rectangle front at graph 0.95,0.95 size char 5,2 fc rgb 'white' fillstyle solid noborder
splot '++' using 1:2:1

The result with 4.6.4 is:



标签: gnuplot