Gnuplot: graph in the correct scale and position on top of the image

My problem is drawing a graph on top of the image. The image is not just designed for a good background, but it must be consistent with the plot.

The plot is a lot of colored dots representing the speed and position of the car in the coordinate system. It works.

Now I want to build a plot with the image of the road, and there I have problems.

The data file is as follows:

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

x-pos, y-pos, speed, ignore the last number

Here is what I still have:

 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 

Unfortunately, the x axis is not aligned:

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

By changing some of the numbers, I can somehow align it, but this is just a random guess.

I tried to add this after the given multiplier:

 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 leads to a little better, but now the scale is wrong?

enter image description here

Also, the image of the road disappears when zooming, choosing a rectangle with RMB?

link to an example data file and track image: http://pastebin.com/e5Yy5BaZ (sorry, the site does not allow me to post more than two links (you need 10 reputation))

+4
source share
1 answer

You do not need to use multiplot , just build two files with one plot command (thanks for the help :) ):

 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:

enter image description here

Notes:

  • set autoscale fix uses narrow ranges (for x , y and cb ) without expanding to the next tic.

  • Using center=(0,0) removes the last explicit dependency on the exact image size

+2
source

Source: https://habr.com/ru/post/1501634/