Plotting binary data in python

Viewed 16837

I have some data that looks like:

data = [1,2,4,5,9] (random pattern of increasing integers)

And I want to plot it in a binary horizontal line so that y=1 for every x value specified in data and zero otherwise.

I have a few different data arrays that I'd like to stack, similar to this style (this is CCD clocking data but the plot format looks ideal)

binary plot

I think I need to create a list of ones for my data array, but how do I specify the zero value for everything not in the array?

Thanks

2 Answers
Related