title: R plot, change scale of values for plot axis
body: <p>I am doing a plot with R, the code for stacked bar and axis 2 are simple, here is the code for line and axis 4:</p>
  
  <p><img src="https://i.stack.imgur.com/Ewk8E.png" alt="enter image description here"></p>
  
  <pre><code>lines(y, 
      theLineValues,     
      type    = "o", 
      pch     = 20,
      lwd     = 2, 
      cex     = 1.2, 
      lty     = 1, 
      col     ="forestgreen")
  
  axis(4, 
      at      = getYaxis(0,1,0.01, 3),    # function to get 3 values for axis
      labels  = getYaxis(0,1,0.01, 3),
      col.axis= "forestgreen", 
      las     = 1,
      cex.axis= 0.7,
      col     = "forestgreen",
      line    = 0)
  </code></pre>
  
  <p>then I found the min and max value: 0.46, 0.68 , and want to use them as axis, so the changing of line can be seen more obviously(the red line). </p>
  
  <pre><code>labels  = getYaxis(min(theLineValues),max(theLineValues),0.01,3),
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/epR0P.png" alt="enter image description here"></p>
  
  <p>How would I scale the 'theLineValues' to do this? </p>
  
  <p>Thanks. </p>
  
  <p>======================================================================
  Update 1: the code for 'y':</p>
  
  <pre><code>y &lt;- barplot(
      combinedvalues,     # it's list of 3-combined values.
      col     = c("slategray1","darkseagreen1","moccasin"),
      beside  = FALSE,
      border = "grey80",
      las     = 1,
      cex.axis= 1.0,
      ann     = FALSE,
      ylim    = c(0,1),
      yaxt    = "n")
  </code></pre>
  
  <p>======================================================================
  Update 2: the combined values:</p>
  
  <p>these values are in .csv file, and use the following to get the 'combinedvalues' and pass it to 'y':</p>
  
  <pre><code>rbind(csv$frame0,csv$frame1,csv$frame2)
  # frame0+frame1+frame2 shoud be 1, theLineValues were calculated by some formulas. 
  </code></pre>
  
  <p>the csv file:</p>
  
  <pre><code>frame0          frame1          frame2          theLineValues
  ------------------------------------------------------------
  0.4460203874    0.2271394791    0.3268401336    0.4674583872
  0.4473756948    0.2084173711    0.3442069341    0.4796977238
  0.5296042291    0.1570493286    0.3133464423    0.570317484
  0.5255498752    0.1234146373    0.3510354875    0.6095475721
  0.5405768621    0.119299957     0.3401231808    0.6251561825
  0.5657840709    0.0916650587    0.3425508703    0.6896446583
  0.4826617968    0.0877739789    0.4295642243    0.6610089801
  0.3588171226    0.122977733     0.5182051444    0.606129318
  0.2608499204    0.1705417922    0.5686082874    0.595971676
  0.2111782825    0.2040231107    0.5847986067    0.6057364576
  0.1731616573    0.240909341     0.5859290016    0.6153720603
  </code></pre>
  
  <p>Thanks. </p>
  
  <p>======================================================================
  Update 3: the final plot:</p>
  
  <p><img src="https://i.stack.imgur.com/fCgie.png" alt="enter image description here"></p>