Created
July 20, 2017 11:22
-
-
Save axsk/d8eae5a458e3266aec32a0f0d5fcf69e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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