Skip to content

Instantly share code, notes, and snippets.


Dave Kleinschmidt kleinschmidt

View GitHub Profile
kleinschmidt / qqplot.jl
Last active Aug 29, 2015 — forked from johnmyleswhite/qqplot.jl
QQ plots in Julia with Gadfly (based on Vega example)
View qqplot.jl
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...)