Overlay an splot and a plot of identical size

Help
2010-03-24
2013-02-10
  • Dipankar Maitra

    Dipankar Maitra - 2010-03-24

    Hi,

    I am trying to create a plot where I first create a surface plot, and then attempt to put a normal 2D plot on top of it so that they both occupy the same exact size.  As an example, a script which partially achieves this is given below (it produces the screenshot shown at http://www.astro.lsa.umich.edu/~dmaitra/gnuplt1.png )

    As you see the regions occupied by splot and plot are quite different.  I can change the 'set origin' and 'set size' of the 'plot' and try to align them manually, but I was wondering if there is a more elegant (and more precise) way to to doing it.

    , and hence I need both plots to occupy exactly the same position.  If there is a better way to do this, that'd be great to know too.

    Regards
    Dipankar

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    #
    set term post enhanced color solid
    set out "merc_m1_red.ps"
    unset key
    set size 1,1
    set multiplot
    set size 1,1
    set xra [0:900]
    set yra [0:250]
    set cbra [0:65535]
    set xla "X (pixels)"
    set yla "Y (pixels)"
    set cbla "Pixel values"
    set origin 0,0
    set lmarg 10
    set rmarg 10
    set tmarg 1
    set bmarg 3
    set tics out
    set cbtics in
    set pm3d map
    splot "merc_m1_red.dat" u 1:2:3
    set origin 0,0
    set lmarg 10
    set rmarg 10
    set tmarg 1
    set bmarg 3
    set tics in
    plot 190.-x/10. w l lw 5 lc rgb 'yellow'
    unset multiplot
    #EOF
    
     
  • Hans-Bernhard Broeker

    Why, oh why, do people always look to multiplot first, when it's not at all the right tool for the job?

    What you need is an splot using more than one dataset, parametric mode and an extension of your 2D plot by a third, constant coordinate.

      set parametric;
      splot 'file_a.dat' using 1:2:3 with pm3d, 'curve.dat' u 1:2:(0.0) with lines
    
     
  • Dipankar Maitra

    Dipankar Maitra - 2010-03-24

    The suggestion works great! Thanks a lot for putting me on track …

     

Log in to post a comment.