Skip to content

Instantly share code, notes, and snippets.

View kleinschmidt's full-sized avatar

Dave Kleinschmidt kleinschmidt

View GitHub Profile
@kleinschmidt
kleinschmidt / qqplot.jl
Last active August 29, 2015 14:05 — forked from johnmyleswhite/qqplot.jl
QQ plots in Julia with Gadfly (based on Vega example)
using Stats, Distributions, Gadfly
import Gadfly.ElementOrFunction
# First add a method to the basic Gadfly.plot function for QQPair types (generated by Distributions.qqbuild())
Gadfly.plot(qq::QQPair, elements::ElementOrFunction...) = Gadfly.plot(x=qq.qx, y=qq.qy, Geom.point, Theme(highlight_width=0px), elements...)
# Now some shorthand functions
qqplot(x, y, elements::ElementOrFunction...) = Gadfly.plot(qqbuild(x, y), elements...)
qqnorm(x, elements::ElementOrFunction...) = qqplot(Normal(), x, Guide.xlabel("Theoretical Normal quantiles"), Guide.ylabel("Observed quantiles"), elements...)