Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

2-D contour plot with gnuplot

  1. Mar 29, 2012 #1
    with gnuplot
    I need to have 2d contour plot from a file (say ss.dat) with three column, first and secend columns are X and Y respectively and the third column is magnitude (I need to have this magnitude with labels on it in 2d plot).

    Thanks in advance
  2. jcsd
  3. Apr 8, 2012 #2
    Assuming your file contains grid data, the basic commands to generate a contour plot would be

    set contour base
    unset sur
    set view map
    splot 'file'

    gnuplot will generate a key mapping dash patterns in the contours to values. If you want actual numerical labels printed on the contours, you have to resort to tricks. I describe one way to do it in the gnuplot Cookbook.
  4. Apr 10, 2012 #3
    Thank you very much. my file dose not have grid data. it just has three coulmn first is "x"axis second "y" and third is just the data I want to have the plot of. How can I grid x and y axis.

  5. Apr 10, 2012 #4
    Your data might already be in grid form, depending on how it is organized. Type "help grid_data" at the gnuplot interactive prompt to find out what this means. Even if it is not, the plot might work. Try it and see. If your data is scattered you might be able to plot it after letting gnuplot convert it into a grid arrangement. Type "help dgrid3d" to find out how to do this.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook