Search code examples
contourxmgrace

Contour plot in Xmgrace


enter image description hereI have a data file containing 3 columns. Now I want to have a contour plot with xmgrace as I use xmgrace mostly. But somehow, I am unable to do draw it now. Can anyone help me a bit? Thanks in advance. The data is in format shown below:

3.24 4.78 0.015776 3.24 4.80 0.011777 3.24 4.82 0.00986 3.24 4.84 0.010185 3.24 4.86 0.012515 3.26 4.78 0.009244 3.26 4.80 0.006368 3.26 4.82 0.005792 3.26 4.84 0.007121 3.26 4.86 0.010361 3.28 4.78 0.004666 3.28 4.80 0.0028 3.28 4.82 0.003017 3.28 4.84 0.005285 3.28 4.86 0.0095 3.30 4.78 0.001295 3.30 4.80 0.000557 3.30 4.82 0.001924 3.30 4.84 0.005266 3.30 4.86 0.010401 3.32 4.78 0 3.32 4.80 0.000233 3.32 4.82 0.002508 3.32 4.84 0.006666 3.32 4.86 0.012515 3.34 4.70 0.012943 3.34 4.72 0.006904 3.34 4.74 0.002791 3.34 4.76 0.000662 3.36 4.70 0.011024 3.36 4.72 0.005998 3.36 4.74 0.003063 3.36 4.76 0.001814 3.38 4.70 0.011203 3.38 4.72 0.007077 3.38 4.74 0.004755 3.38 4.76 0.004188 3.40 4.70 0.01263 3.40 4.72 0.009182 3.40 4.74 0.007685 3.40 4.76 0.007985

The final curve should be like as shown in the attachment.


Solution

  • A quick Google search reveals that xmgrace (a.k.a. Grace) does not support contour plots

    There are a wealth of example scripts for contour plots using gnuplot, matplotlib, Origin and many more.

    Here is a simple example for gnuplot using your data: Once you have saved your data as the 3-column data file data.dat save the following as a script file:

    set parametric
    set contour base
    set view 0,0,1
    unset surface
    unset key
    unset ztics
    set dgrid3d
    set title "Simple contour plot example" 
    set xlabel "X" 
    set ylabel "Y" 
    set cntrparam levels 10
    splot "data.dat" using 1:2:3 with line
    

    and from the UNIX command line call gnuplot -persist scriptfile. This gives the following output: enter image description here

    So, it looks like you didn't use xmgrace, you used gnuplot, and that's why you can't work out how to remake the original plot in xmgrace again!