title: Get xlim from a plot in R
body: <p>I want an hist and a density on the same plot, I'm trying this: </p>
  
  <pre><code>myPlot &lt;- plot(density(m[,1])), main="", xlab="", ylab="")
  par(new=TRUE)
  
  Oldxlim &lt;- myPlot$xlim
  Oldylim &lt;- myPlot$ylim
  
  hist(m[,3],xlim=Oldxlim,ylim=Oldylim,prob=TRUE)
  </code></pre>
  
  <p>but I can't access myPlot's xlim and ylim. </p>
  
  <p>Is there a way to get them from myPlot? What else should I do instead? </p>