title: How to obtain multiple lines in a single density plot, with a corrected scale?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6939136/how-to-overlay-density-plots-in-r">How to overlay density plots in R?</a>  </p>
  </blockquote>
  
  
  
  <p>I have recently started working with microarray datasets and am trying to get my hands on R. I wish to make some plots out of my result data, but however I am stuck at the following.</p>
  
  <p>I have the following data (myData), </p>
  
  <pre><code>cpg samp1 samp2 samp3 
  cpg1 0.43 0.32 0.21 
  cpg2 0.43 0.22 1.00 
  cpg3 0.11 0.99 0.78 
  cpg4 0.65 0.32 0.12 
  cpg5 0.11 0.43 0.89
  </code></pre>
  
  <p>And I wish to obtain a density plot for this, </p>
  
  <p>I did the following, </p>
  
  <pre><code>plot (density(MyData$samp1), col="red") 
  lines (density(MyData$samp2), col="green") 
  lines (density(MyData$samp3), col="blue") 
  </code></pre>
  
  <p>But doing this does not give me correct plots, because not all sample curves fit within the plot limits. I did try looking for answers, but honestly i am still not able to work this out. 
  Can you help me know how do i set my scale for the above? Or what additional should I do to the above code, so that all the curves are in range?? I have got many samples, so i need a something that could also automatically assign a different colour curve for each of my sample, after scaling it right.</p>
  
  <p>Thanks in advance.. </p>