Menu

Superimpose Scatter Plot on a Contour Plot

Help
2005-06-17
2013-02-10
  • Angelo R. Rossi

    Angelo R. Rossi - 2005-06-17

    Dea All:

    Can someone show me how to superimpose a group of points onto a contour plot?

    I tried to do this with a combination of

    1) the "splot command" to give the contours

    followed by

    2) the "plot command"  to produce the points which would be overlayed onto the contour plot.

    But, this straightforward combination doesn't seem to work.  I obtain either TWO plots on two different screens or errors are given which seem to indicate an incompatibility.

    Can you show me th trick to do this?

    Regards,

    Angelo

     
    • Hans-Bernhard Broeker

      If you really want the output put of two separate plotting commands on the same page, see "help multiplot".  But that's generally not useful for mixing an splot and a plot.

      See "help contour" for how to do this through an intermediate file holding the contour lines.

      Or splot both in one command, inventing a z coordinate for the point clouds.

       
      • Angelo R. Rossi

        Angelo R. Rossi - 2005-06-19

        Dear Hans-Bernhard Broeker:

        Thank you for being so responsive, but this is a frustrating experience.  Just to make sure you understand the problem let me reiterate my problem and your response, and my response to your response.

        1) I have drawn an excellent contour map of dihedral angles, phi and psi, versus energy to give the contour map.  The phi's, the psi's and energy were the result of calculation. 

        This was done using a suggestion by you of using "set view map" following by "splot"

        Now I want to put the experimental points at locations of for phi and psi on the contour plot.  There is no energy. 

        This is equivalent to drawing a fitting function through experimental points.  But it is easier to do in this case because both the fit points and the experimental points are done using the "plot" function.

        2) Your first suggestion: See "help contour" for how to do this through an intermediate file holding the contour lines.

        This could work OK but then you use the functionality of the automatic coloring of the contours.   All contours are one color, and a lot more work has to be done to get multi-color contour plots.

        3) Your seecond suggestion: Or splot both in one command, inventing a z coordinate for the point clouds.

        There is gotta be a trick to this.  splot does't recognize the data properly.  I get no points with splot even with a file "helices.dat" like this:

        # alpha helix
        -57.0 -47.0  -400.0

        # 3-10 helix -400.0
        -49.0 -26.0

        # pi helix
        -75.0 -60.0  -400.

        Notice the -400.0 is an energy value I made up to "trick" splot because there is a -400.0 contour so it should appear.  No points appear ... just the contour plot.  Here is the file

        set xrange [-80.0 : -40.0]
        set yrange [-70.0 : -20.0]
        set zrange [-500.0 : -240.0]

        set xtics  4
        set mxtics 2
        set ytics  4
        set mytics 2

        set view map
        set nosurface
        set cont
        set ticslevel 0
        set data style lines
        set isosamples 100,100; set samples 100,100
        set cntrparam level incremental -400,15,-215

        # set cntrparam levels auto 20

        set term postscript landscape enhanced color solid
        set output "eaton.eps"

        set size sq 1.00,1.00
        set zero 1e-20
        set pointsize 1.
        set tmargin 1

        set xlabel "{/Symbol f}"
        set ylabel "{/Symbol y }"
        set label "{/Symbol a}-Helix" at -59.0,-47.0
        set label "3-10 Helix" at -51.0,-26.0
        set label "{/Symbol p}-Helix" at -77.0,-60.0
        set label "Energy (kcal/mol)" at -25.0,-2.5

        splot "eaton_helix_tor1.map" u 1:2:3 notitle w pm3d, "helices.dat" w points

        pause -1

        Can you help me out?

        Best regards,

        Angelo

         
        • Hans-Bernhard Broeker

          The reason why method 3) doesn't work is the 'set nosurface' command.  It may not look be obvious from the name of this setting, but this will actually turn off all normal 3D plot output except the contours.

          What you're ultimately looking at is a usage limitation of the 'contour' code: it's a global mode setting of the entire program, when it should really be just a data-file filtering option.  We haven't got round to changing that yet.  Until someone changes this in the source code, I'm afraid you will have to stick with method 2), using the 'index' selector to give each contour line a separate colour.

           
    • Angelo R. Rossi

      Angelo R. Rossi - 2005-06-19

      Dear Hans-Bernhard Broeker:

      The correct command for the previous post is

      splot "eaton_helix_tor1.map" u 1:2:3 notitle w lines, "helices.dat" w points

      Regards,

      Angelo

       

Log in to post a comment.