0

I am trying to plot a data (x, y, z) in gnuplot of range x=(0, 50k+) , y=(0,50k+). However, the data need to be super imposed on a map which is of size (2000, 2000).

The issue I am having is, the x and y axis range is 50k+ and the data is plotting nicely, however, the image is rendered in a corner mapping the (0, 2000) range in axis. I need to render the map independent of the data axis comprising the whole plot area, over the ata range. Following is what I am trying that doesn't scale the image,

reset

set dgrid3d 200,200 qnorm 2
set xrange [0:57599]
set yrange [0:57599]

set table $Data
  splot "data.dat" using 1:2:4 
unset table

# create contour lines
set contour base
set cntrparam level incremental 0, 5, 100
unset surface

set table $Contour
  splot "data.dat" using 1:2:4 
unset table
unset key
set palette defined ( 0 "#ff0000", 40 "#0000ff", 60 "#00ff00", 100 "#e0e0e0" )
set size square
set style fill transparent solid 0.4 noborder
plot    "Map.png" binary filetype=png w rgbimage, \
        $Data u 1:2:(6):(6):3 with boxxyerror palette,\
        $Contour u 1:2:3 w l lt rgb "grey"

This is what I am getting,

enter image description here

this is what I am trying to do,

enter image description here

2 Answers 2

2

There are auxilliary keywords that can modify binary filetype=png w rgbimage. The ones you want are dx and dy (see "help binary keywords"). In your case the image is 2000x2000 pixels and each pixel represents an area 57599/2000 = 28.8, so the plot command becomes

plot    "Map.png" binary filetype=png dx=28.8 dy=28.8 with rgbimage, \
    $Data u 1:2:(6):(6):3 with boxxyerror palette,\
    $Contour u 1:2:3 w l lt rgb "grey" 

If necessary, you can adjust the image placement relative to the origin of the plot using the keyword origin=(x0,y0)

Sign up to request clarification or add additional context in comments.

Comments

2

Alternative answer if you are using the current version (5.4) of gnuplot

Instead of drawing your map as part of the plot command with rgbimage, you can place it as a pixmap filling the plot area and then draw your plot on top of it. The syntax for that would be:

  set pixmap 1 "Map.png" at graph 0,0 size graph 1,1 back
  plot $Data u 1:2:(6):(6):3 with boxxyerror palette,\
       $Contour u 1:2:3 w l lt rgb "grey"

However this loses any connection between the coordinates of the map and the plot, so it is entirely up to you to make sure they match. For example if you zoom the above plot, the zoomed plot will contain a subset of the original data and contours but the entire map image will still be used to fill the plot area. In the solution using with rgbimage, the map and the contours would all zoom together.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.