title: How do I get a raster plot of nonhomogeneous spikes if I have a sequence of spike times over the total duration, in R?
body: <p>I am new to R (relatively) so this question might have a simple answer. I have been trying to plot non homogeneous Poisson Process in R. Through the code below, for one trial of 10 seconds, I have a sequence <code>nhpp1</code> which consists of the time stamps where spikes occurred, in this particular trial. How do I take this sequence <code>nhpp1</code> and get a raster plot of it. More importantly, I want to repeat (replicate?) this whole thing for 10 trials and get a raster plot which looks something like this: (please look below the code)</p>
  
  <pre><code> nhpp &lt;- function(lambda){
   set.seed(1)
   t_max = 10
   t = 0 
   s = 0
   Lambda &lt;- function(tupper) integrate(f=lambda, lower =0, upper= 
             tupper)$value
   LambdaInv &lt;- function(s) {
           v &lt;- seq(0, t_max+1, length=1000)
           min(v[which(Vectorize(Lambda)(v) &gt;= s)])
             }
   X = numeric(0)
   while(t &lt;= t_max){
    u &lt;- runif(1)
    s &lt;- s-log(u)
    t &lt;- LambdaInv(s)
    X &lt;- c(X,t)
  
    }
   return(X)
  }
  
  lambda &lt;- function(t) 100*(sin(pi*t)+1)
  nhpp1 &lt;- nhpp(lambda)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kKhFc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kKhFc.jpg" alt="Raster Plot"></a></p>
  
  <p>I have the spike time stamps already, I need help regarding finding a way to plot this one trial (with tiny bars occurring where spikes happen on the timeline) and how to replicate this process for 10 trials, then? Any help will be very appreciated. </p>