[started by Tareque and Nugraha, 2009.10.28]

How to plot contour using gnuplot

Contour plot can be made with gnuplot, e.g., for the case of z = f(x,y). Electronic dispersion of a two dimensional graphite plane (graphene) is a good example of a contour plot. See the equations in Saito-sensei's CNT book. A general way to plot contour is by taking the data (*.dat) file format (e.g. graphene.dat).

Script:

  • Please set your own x,y range and x,y label
    gnuplot> set contour 
    gnuplot> set dgrid3d 50,50,40 
    gnuplot> set cntrparam levels 20 
    gnuplot> unset surface 
    gnuplot> unset key
    gnuplot> set xlabel 'kx' 
    gnuplot> set ylabel 'ky' 
    gnuplot> set xrange [-8:8] 
    gnuplot> set yrange [-8:8] 
    gnuplot> splot 'graphene.dat' with lines 
  • To make the surface square:
    gnuplot> set size 0.721,1 
    gnuplot> replot 
  • Saving the gnuplot figure:
    • in png format
      gnuplot> set term png
      gnuplot> set output 'graphene.png'
      gnuplot> replot
    • in eps format
      gnuplot> set term postscript
      gnuplot> set output 'graphene.ps'
      gnuplot> replot
    • in pdf format
      • we must use eps as an input
        flex> epstopdf graphene.eps
      • the output will be graphene.pdf

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2009-11-18 (Wed) 05:12:33 (2866d)