Spike train representation

I have a spike train. The data shows the time at which the neuron fired a spike. I want to plot them like this picture:

Here is the data for one spike train which corresponds to the one of the neurons in the figure above.

-
This can be done really easily. But your data are much larger than those on your plot. – Öskå Jul 25 '14 at 13:46
@Öskå I just put the data as a sample of the spike train in case it is needed. – MOON Jul 25 '14 at 14:19

Here is an example with some random data:

SeedRandom@0;
dat = Sort /@ RandomInteger[{200, 700}, {3, 25}];
Graphics[{Hue@.5, Opacity@.7,
MapIndexed[Line@Outer[List, #, 40 #2[[1]] + {20, -20}] &, dat]},
Axes -> {True, True},
Ticks -> {Automatic, Thread@{Range[40, 3*40, 40], Range@3}}]


With your data, it's a different story and it looks like:

data = ToExpression@Import["http://pastebin.com/raw.php?i=Vj4nQNB5"];
Graphics[Line[{{Log@#, .5}, {Log@#, 1.5}}] & /@ data]


-
You can replace your Table expression with: MapIndexed[Line @ Outer[List, #, 40 #2[[1]] + {20, -20}] &, dat] – Mr.Wizard Jul 25 '14 at 14:35
@Mr.Wizard Thanks! I knew that there was something but I just considered that Table was fast enough for this.. :) – Öskå Jul 25 '14 at 17:39

DistributionChart with ChartElementFunction->"LineDensity"

spktrnF[data_, opts : OptionsPattern[]] :=
Module[{options = {ChartBaseStyle -> EdgeForm[None],
ChartElementFunction -> "LineDensity",
BarOrigin -> Left, BarSpacing -> 0.1,
ChartLabels -> Range[Length@data]}},
DistributionChart[data, If[opts === {}, options, PrependTo[options, {opts}]]]]

SeedRandom@0;
dat = Sort /@ RandomInteger[{200, 700}, {5, 100}];

spktrnF[dat, ImageSize -> 800, AspectRatio -> 1/3,
ChartStyle -> "SolarColors", FrameStyle -> 16,
FrameLabel -> {"Time", "Neuron", None, None}]


-

You could use ArrayPlot.

t = Flatten @ Import["f:\\spikes.dat"];
p = ConstantArray[0, Max[t]];
p[[t]] = 1;
ArrayPlot[{p[[1 ;; 1000]], p[[1000 ;; 2000]]},
AspectRatio -> 1/10,
FrameTicks -> Automatic,
FrameLabel -> {"neuron", "time"}]


But this approach is bad for data with more than 1000 time records

-