title: about plot contour figure by using r code
body: <p>I am a green-hand on R code. Now I meet some trouble in plotting contour figure by using R code.</p>
  
  <p>I have checked help(filled.contour) which tells that if you want to plot the contour, x,y should be both in ascending order. Actually, I receive the data randomly, like:</p>
  
  <pre><code>latitude, longitude, value
  37.651098 140.725082 9519
  37.650765 140.725248 9519
  37.692738 140.749118 23600
  37.692737 140.749118 9911
  37.692695 140.749107 16591
  37.692462 140.74902 6350
  37.692442 140.749052 5507
  37.692413 140.749148 5476
  37.692383 140.74929 7069
  37.692357 140.749398 6152
  37.692377 140.749445 6170
  37.692355 140.749587 7163
  37.692298 140.749672 6831
  37.692292 140.749787 6194
  37.692283 140.749903 6696
  37.692342 140.750007 8204
  37.692585 140.750037 2872
  37.692648 140.749948 3907
  37.692655 140.749827 4891
  37.692667 140.749687 4899
  </code></pre>
  
  <p>How can I plot the contour figure!? 
  Here is my code: </p>
  
  <pre><code>args &lt;- commandArgs(trailingOnly = TRUE) 
  data1 &lt;- args[1]
  outputDir &lt;- args[2]
  outputFig = paste(outputDir, "Cs13x.jpeg",sep="");
  jpeg(file = outputFig, width = 800,height=600, pointsize=20)
  pinkcol &lt;- rgb(1,0.7,0.7)
  
  gpsdata &lt;- read.table(file=data1,sep=" ");
  lat &lt;- as.vector(gpsdata[,1]);
  lon &lt;- as.vector(gpsdata[,2]);
  datas &lt;- as.vector(gpsdata[,3]);
  datas &lt;- abs(datas)
  #---Convert gpsdata into x,y coordinate---#
  # Convert degree into value
  lat_pi &lt;- lat*pi/180;
  lon_pi &lt;- lon*pi/180;
  # calculate the value into corresponding x,y coordinate
  x = cos(lat_pi) * cos(lon_pi);
  y = cos(lat_pi) * sin(lon_pi);
  #----------#
  dataMatrix = matrix(datas, nrow = length(datas), ncol=length(datas));
  plot.new()
  filled.contour(sort(x),sort(y, decreasing = TRUE),dataMatrix, col = rainbow(100),     main="Contour Figure of Cs13x"); (**WRONG HERE!!!**)
  dev.off()
  </code></pre>
  
  <p>&lt;-------------- FINISH LINE -----------></p>