Plot 用图像和透明的数据文件矩阵组成绘图

Plot 用图像和透明的数据文件矩阵组成绘图,plot,gnuplot,transparency,alpha-transparency,Plot,Gnuplot,Transparency,Alpha Transparency,我正在尝试使用城市地图图像进行绘图 覆盖这个 与该位置的街道相匹配,并生成这样的图形 通过GIMP生成 我想用Gnuplot制作一个类似于上面的图,将两幅图像叠加在后面的地图和前面的pher.txt数据上 我可以使用此脚本绘制地图: set encoding iso_8859_1 set term postscript eps enhanced color size 5in,5in set output 'image.eps' unset key; unset tics; unset bo

我正在尝试使用城市地图图像进行绘图

覆盖这个

与该位置的街道相匹配,并生成这样的图形

通过GIMP生成

我想用Gnuplot制作一个类似于上面的图,将两幅图像叠加在后面的地图和前面的pher.txt数据上

我可以使用此脚本绘制地图:

set encoding iso_8859_1
set term postscript eps enhanced color size 5in,5in
set output 'image.eps'
unset key; unset tics; unset border
set size ratio -1
set size square
set lmargin screen 0
set bmargin screen 0
set rmargin screen 1
set tmargin screen 1
plot 'ghent0.png' binary filetype=png with rgbimage
借用此链接来绘制地图

要绘制热图,我使用以下代码:

set terminal pngcairo nobackground #size 800,800
# set encoding iso_8859_1
# set term postscript eps enhanced color size 5in,5in
set output 'foo.png'
set size square
unset xtics 
unset ytics
val = 0
set autoscale xfix
set autoscale yfix
set cbrange [0:9]
set yrange [:] reverse
# plot 'pher.txt' matrix using ($1 == val ? NaN : $1) with image notitle
plot 'pher.txt' matrix with image notitle
为了使黑色透明,我尝试使用($1==val?NaN:$1)绘制'pher.txt'矩阵,图像notitle借用了“”,它告诉Gnuplot将NaN值放在
pher.txt
矩阵数据文件中的0处。但是,它不起作用。 此外,两个图层(图像地图和带黑色透明的热图)应调整大小,以便热图线与地图的街道匹配

注意:地图图像和文件
pher.txt
在此链接中


当您
绘图时,请注意。。。带图像的矩阵
图像值位于第三列,而不是第一列。这是一个在(x,y)坐标系中绘制地图并在(x2,y2)坐标系中绘制数据的解决方案。这样,只需设置
x2range
y2range
,即可相对于前者重新缩放后者:

set size square
set xtics nomirror
set ytics nomirror
set x2tic
set y2tic
set x2range [-1:200]
set y2range [-1:204] reverse
set autoscale noextend
set cbrange [0:9]
plot 'ghent0.jpg' binary filetype=jpg with rgbimage, \
     'pher.txt' matrix using 1:2:($3 == 0 ? NaN : $3) axes x2y2 with image notitle