title: xyplot with confidence interval (box and wisker plot) added in r
body: <p>I want to add 99% and 95% confidence interval in XYplot. </p>
  
  <p>The following is data:</p>
  
  <pre><code>X &lt;- 1:20
  Y &lt;- c(0.5, 1.4, 2.3, 3.4, 4.5,
        3.3, 3.0, 2.1, 1.5, 0,
        0, 3.4, 4.5, 6.7, 5.3, 2.8,
        0.5, 3.4, 3.5,  3.7)
  mydata &lt;- data.frame (X, Y)
  </code></pre>
  
  <p>I want to identify the maximum value of Y and corresponding X value is position of median in box and whisker plot. Whenever the value of Y declines by 1 point (either left or right) is the 99% confidence interval (will be inside the box) and whenever the Y declines to 2 (both left and right), the corresponding positions in x will be represented by the whisker.</p>
  
  <p>Desired plot:</p>
  
  <p><img src="https://i.stack.imgur.com/ayWxj.jpg" alt="enter image description here">   </p>
  
  <p>Explanation. 
  <img src="https://i.stack.imgur.com/LU18F.jpg" alt="enter image description here"></p>
  
  <p>corresponding x value to  max(Y) = 6.7 
  corresponding x value to  box left = 6.7 - 1, box right = 6.7 - 1
  corresponding x  value to whisker left = 6.7 - 2, whisker right = 6.7 - 2   </p>