title: Precipitation plot, or mirrored histogram based on top axis
body: <p>I like to plot simple time series data and overplot precipitation data. The following code plots a line for the usual data and adds barplots (or histogram bars) for the precipitation data.</p>
  
  <pre><code>D # a simple (zoo) time series
  P # a simple (zoo) time series of precipitation
  plot(D, type="l")
  lines(P, type="h", lwd=5)
  </code></pre>
  
  <p>But the bars are based on the y=0 axis and rise topwards. But usual in hydrology are precipitation bars that are based on the very top axis and "flow" downwards. <code>D</code> has arbitrary y-ranges, so I would prefer a solution that does fix a value for the baseline of <code>P</code>.</p>
  
  <p>I googled a lot but did not manage to find how to do this in R without ggplot and without extra packages like hydrograph.</p>