gnuplot:绘制正确的比例&位于图像顶部 [英] gnuplot: Plot in correct scale & position on top of image
问题描述
我的问题是在图像上绘制一个情节。
图像不仅仅是一个很好的背景,而且应该与情节对齐。
情节是许多有色点代表汽车的速度和位置在坐标系中。这是有效的。
现在我想用一张道路图像排列情节,我有问题。
数据文件如下所示:
-60.2501 106.115 0 0
-68.1729 98.0388 0 0
[...]
x-pos,y-pos,speed,ignore last last
以下是我目前的情况:
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(0black,0.25blue ,0.5红色,0.75黄色,1绿色)
绘图'output.txt'使用1:2:3使用点调色板pt 6 ps 0.1
unset multiplot
悲伤地沿着x轴它没有排列:
(sor ry,该网站不允许我发布2个以上的链接(需要10个声望))
你不需要为此使用 multiplot
,只需用一个 plot
命令绘制两个文件(感谢提示:)
):
重置
设置尺寸比率1
set autoscale fix
set key autotitle columnhead
set palette defined(0black,0.25blue,0.5red,0.75yellow,1green)
plot'BL.jpg'binary filetype = jpg center =(0,0)with rgbimage notitle,\
'output.txt'with 1:2:3 with points palette pt 6 ps 0.1 title columnheader(1)
这给出:
注意:
-
设置自动缩放修复
使用紧密范围(x
,y
和cb
),没有expandi到下一个抽搐。 -
使用
center =(0,0)
删除最后一个显式依赖项确切的图像尺寸
My problem is drawing a plot atop an image. The image is not just meant to be a nice background but should line up with the plot.
The plot is many colored points representing a car's speed and position in a coordinates system. That works.
Now I want to line up the plot with an image of the road and there I have problems.
The data file looks like this:
-60.2501 106.115 0 0
-68.1729 98.0388 0 0
[...]
x-pos, y-pos,speed, ignore last number
Here is what I have so far:
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
Sadly along the x-axis it is not lined up:
http://www.abload.de/img/doesnotlineuposs6n.png (1280 x 960 Pixels, 311KB)
By adjusting some numbers I can kind of line it up but that is just random guessing.
I tried adding this after the set multiplot :
set lmargin at screen 0.1
set rmargin at screen 0.98
set tmargin at screen 0.98
set bmargin at screen 0.2
which results in a bit better fit but now the scale is wrong?
Also the road image disappears when zooming in by selecting a rectangle with RMB?
link to example data file and track image: http://pastebin.com/e5Yy5BaZ (sorry, the site does not allow me to post more than 2 links (need 10 reputation))
You don't need to use multiplot
for this, just plot the two files with a single plot
command (Thanks for the hint :)
):
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)
This gives:
Notes:
set autoscale fix
uses tight ranges (forx
,y
andcb
), without expanding to the next tic.Using
center=(0,0)
removes the last explicit dependency on the exact image dimensions
这篇关于gnuplot:绘制正确的比例&位于图像顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!