Skip to content

Instantly share code, notes, and snippets.

@axsk
Created July 20, 2017 11:22
Show Gist options
  • Save axsk/d8eae5a458e3266aec32a0f0d5fcf69e to your computer and use it in GitHub Desktop.
Save axsk/d8eae5a458e3266aec32a0f0d5fcf69e to your computer and use it in GitHub Desktop.
using Plots
rect(x,y,w,h) = Shape(x+[0,w,w,0], y+[0,0,h,h])
@recipe function f(ds::Array{Measurement}; alpha = 1)
isempty(ds) && return []
binedges = [0,10,12,14,16,18,20,25]
nmax = nfollicles(ds)
a = alpha
cs = cvec(:rainbow, nmax)
for data in ds
for (b, n) in enumerate(data.bins)
n == 0 && continue
@series begin
x = data.day - .5
y = binedges[b]
w = 1
h = binedges[b+1] - y
color := cs[n]
rect(x,y,w,h)
end
end
end
end
binmax(ds::Array{Measurement}) = maximum(binmax, ds)
binmax(d::Measurement) = maximum(d.bins)
nfollicles(ds::Array{Measurement}) = maximum(nfollicles, ds)
nfollicles(d::Measurement) = sum(d.bins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment