这不应该是一个解决方案,而是一个解释和一个可能的,虽然丑陋的解决方法。
gnuplot邮件列表时不时会有关于这个问题的报告,但似乎与观众有关。它与gnuplot 创建曲面图的方式有关。这些被绘制为多边形,它们被缝合在一起。您显示的莫尔图案来自两个多边形之间的错误渲染。这取决于查看器、查看器设置和缩放系数。
显示该效果的最简单示例是以下 Postscript 文件:
%!PS-Adobe-2.0
50 50 moveto 50 0 rlineto 0 50 rlineto -50 0 rlineto closepath 0 setgray fill
100 50 moveto 50 0 rlineto 0 50 rlineto -50 0 rlineto closepath 0 setgray fill
保存此文件,例如作为moire.ps 并查看它,或将其转换为ps2pdf 并查看它。使用 Acrobat reader 9.5.1 我看到以下内容:
Acrobat Reader 有一个设置Preferences -> Page Display -> Enhance thin lines 可以防止此问题,但会导致其他部分出现问题。
在我的系统 (Debian) 上,所有查看器都显示此模式,mupdf、firefox、ghostscript、pdftocairo、libpoppler` 等。
那么,该怎么办?对于我自己,我使用以下解决方法。我将splot 转换为高分辨率的png,稍后使用plot ... with rgbimage 重新读取该文件。然后你得到你的热图作为位图,其余的都是矢量的。在大多数情况下,这没有问题,因为无论如何您都有一些分辨率有限的测量数据,您可以对其进行插值。
基于问题gnuplot contour line color: set style line and set linetype not working,您可以通过以下方式实现它:
reset
set lmargin at screen 0.05
set rmargin at screen 0.85
set bmargin at screen 0.1
set tmargin at screen 0.9
set pm3d map interpolate 20,20
unset key
set cntrparam bspline
set cntrparam points 10
set cntrparam levels increment -6,-6,-24
set contour surface
set linetype 1 lc rgb "blue" lw 2
set linetype 2 lc rgb "blue"
set linetype 3 lc rgb "black"
set linetype 4 lc rgb "orange"
set linetype 5 lc rgb "yellow"
set palette rgb 33,13,10 #rainbow (blue-green-yellow-red)
set cbrange [-18:0]
unset border
unset xtics
unset ytics
set angles degree
r = 3.31
set xrange[-r:r]
set yrange[-r:r]
set colorbox user origin 0.9,0.1 size 0.03,0.8
##################### start changes ##############
set autoscale fix
RES_X = 2000
RES_Y = 2000
save('settings.tmp')
set lmargin at screen 0
set rmargin at screen 1
set bmargin at screen 0
set tmargin at screen 1
unset colorbox
set terminal pngcairo size RES_X, RES_Y
set output '3d-polar-inc.png'
splot 'new_test.dat' nocontour
unset output
load('settings.tmp')
# mapping of the coordinates for the png plotting later
X0 = GPVAL_X_MIN
Y0 = GPVAL_Y_MIN
DX = (GPVAL_X_MAX - GPVAL_X_MIN)/real(RES_X)
DY = (GPVAL_Y_MAX - GPVAL_Y_MIN)/real(RES_Y)
C0 = GPVAL_CB_MIN
DC = GPVAL_CB_MAX - GPVAL_CB_MIN
C(x) = (x/255.0) * DC + C0
# now plot the png
#set terminal pdfcairo size 10cm,10cm
#set output '3d-polar.pdf'
set terminal postscript eps color level3 size 10cm,10cm solid
set output '3d-polar-eps.eps'
set multiplot
set cbrange[GPVAL_CB_MIN:GPVAL_CB_MAX]
plot '3d-polar-inc.png' binary filetype=png \
origin=(X0, Y0) dx=DX dy=DY \
using (C($1)):(C($2)):(C($3)) \
with rgbimage, \
NaN with image t '' # hack for getting the colorbox
# plot the contours
unset surface
unset pm3d
splot 'new_test.dat' w l
###################### end changes #################
# now plot the polar grid only
set style line 11 lc rgb 'black' lw 2 lt 0
set grid polar ls 11
set polar
set logscale r 10
set rrange[10:20000]
unset raxis
set rtics format '' scale 0
#set rtics axis scale
set rtics (20,50,100,200,500,1000,2000,5000,10000,20000)
do for [i=-150:180:30] {
dum = r+0.15+0.05*int(abs(i/100))+0.05*int(abs(i/140))-0.05/abs(i+1)
set label i/30+6 at first dum*cos(i), first dum*sin(i) center sprintf('%d', i)
}
set label 20 at first 0, first -(log(20)/log(10)-1) center "20"
set label 100 at first 0, first -(log(100)/log(10)-1) center "100"
set label 200 at first 0, first -(log(200)/log(10)-1) center "200"
set label 1000 at first 0, first -(log(1000)/log(10)-1) center "1k"
set label 2000 at first 0, first -(log(2000)/log(10)-1) center "2k"
set label 10000 at first 0, first -(log(10000)/log(10)-1) center "10k"
set label 20000 at first 0, first -(log(20000)/log(10)-1) center "20k"
plot NaN w l
unset multiplot
unset output
pdfcairo 会生成 1.7 MB 的 pdf 文件,epslatex level3(此选项仅在 4.7 开发版中可用)会生成 1.5 MB eps 文件,可以使用 epstopdf 将其转换为 136 KB pdf 文件。
另请参阅我在 TeX.SX 上对 Big data surface plots: Call gnuplot from tikz to generate bitmap and include automatically? 的回答。