title: Can You Calculate the Area of a Contour in Gnuplot?
body: <p>I've been using gnuplot for a couple of weeks now. I have large data files with 23 variables, but I select specifically x-y co-ordinate data and fluorescence intensity data for my analysis.</p>
  
  <p>On of the things I would like to do is a contour plot of my fluorescing particles. I should add that this contour plot is over time so there will be several spots nearly overlapping, but this is in fact the same particle. I would like to draw contours around these spots, colour code according to intensity and have the area of the contour displayed on the graph.</p>
  
  <p>I have achieved all but one of these goals for my contour plot. I cannot devise a way for gnuplot to calculate and display the area within the contour. If I could then I would have an estimate of the area of my particle. I recognise my goal may be beyond the capabilities of gnuplot, but if there were a solution then it would be very neat.</p>
  
  <p>Here is my script for the contour plot which as I said gives everything I need bar the area within contours.</p>
  
  <p>The co-ordinates are in nanometres and each point on the dataset is the centre of a molecule. I have taken a small range of co-ordinates because there is so much data, it would not be possible to distinguish otherwise (there are over 80 000 data points). I have also set a threshold of intensity as I only want relatively bright fluorescent particles (done with set cntrparam levels incremental 8000,5000,100000). $23 and $24 are the x and y co-ordinates respectively. $12 is the intensity.</p>
  
  <pre><code>#Contour plot of Fluorescent Particle Location with Intensity
  #Gnuplot script file for plotting data in file "1002 all.txt"
  reset
  set dgrid3d 100,1000,1
  set pm3d
  set isosample 30
  set xlabel 'x (nm)'
  set ylabel 'y (nm)'
  set contour base
  set cntrparam levels incremental 8000,5000,100000
  unset key
  unset surface
  set view map
  set xrange[20000:22000]
  set yrange[7000:10000]
  splot "1002 all.txt" using ($23&lt;22000 &amp;&amp; $23&gt;20000 ?$23 : 1/0):$24&lt;10000 &amp;&amp; $24&gt;7000 ?$24 : 1/0):12 with lines
  set terminal push               
  
  
  set terminal png                
  set output "1002_all_fluorophores_section_contour.png" # set the output filename
  set terminal png size 1280,760
  replot    
  set output                               
  </code></pre>