gnuplot:绘制正确的比例&位于图像顶部

时间:2013-09-11 10:29:25

标签: image gnuplot scatter-plot

我的问题是在图像上绘制一个情节。 图像不仅仅是一个很好的背景,而且应该与情节对齐。

该图是许多彩色点,表示汽车在坐标系中的速度和位置。这很有效。

现在我想用一张道路图像排列情节,我有问题。

数据文件如下所示:

-60.2501 106.115 0 0
-68.1729 98.0388 0 0
[...]

x-pos,y-pos,speed,忽略最后一个数字

这是我到目前为止所做的:

set multiplot

set yrange [-1280:1280]
set xrange [-1280:1280]
# set xrange [-1470:1280]

set size ratio 1
plot 'BL.jpg' binary filetype=jpg origin = (-1280,-1280) with rgbimage

set origin 0, 0
set size ratio 1

set yrange [-1280:1280]
set xrange [-1280:1280]
set key autotitle columnhead
set palette defined (0 "black", 0.25 "blue", 0.5 "red", 0.75 "yellow", 1 "green")
plot 'output.txt' using 1:2:3 with points palette pt 6 ps 0.1

unset multiplot

可悲的是,沿着x轴,它没有排成一行:

http://www.abload.de/img/doesnotlineuposs6n.png (1280 x 960像素,311KB)

通过调整一些数字,我可以对其进行排序,但这只是随机猜测。

我尝试在设置多重插图之后添加它:

set lmargin at screen 0.1
set rmargin at screen 0.98
set tmargin at screen 0.98
set bmargin at screen 0.2

这会导致更合适,但现在规模是错误的?

enter image description here

通过选择带RMB的矩形,放大道路图像也会消失。

链接到示例数据文件和跟踪图像: http://pastebin.com/e5Yy5BaZ (对不起,该网站不允许我发布超过2个链接(需要10个声誉))

1 个答案:

答案 0 :(得分:2)

您不需要使用multiplot,只需使用一个plot命令绘制两个文件(感谢提示:)):

reset
set size ratio 1
set autoscale fix
set key above autotitle columnhead
set palette defined (0 "black", 0.25 "blue", 0.5 "red", 0.75 "yellow", 1 "green")
plot 'BL.jpg' binary filetype=jpg center=(0,0) with rgbimage notitle,\
     'output.txt' using 1:2:3 with points palette pt 6 ps 0.1 title columnheader(1)

这给出了:

enter image description here

注意:

  • set autoscale fix使用紧密范围(适用于xycb),而不会扩展到下一个抽搐。

  • 使用center=(0,0)删除对确切图片尺寸的最后显式依赖