wine
This commit is contained in:
parent
dfc7658426
commit
7dfcbabe0c
306
examples/meetup/wine.ipynb
Normal file
306
examples/meetup/wine.ipynb
Normal file
File diff suppressed because one or more lines are too long
4899
examples/meetup/winequality-white.csv
Executable file
4899
examples/meetup/winequality-white.csv
Executable file
File diff suppressed because it is too large
Load Diff
@ -58,17 +58,17 @@ end
|
|||||||
|
|
||||||
|
|
||||||
"Do a correlation plot"
|
"Do a correlation plot"
|
||||||
function corrplot{T<:Real,S<:Real}(mat::AMat{T}, corrmat::AMat{S};
|
function corrplot{T<:Real,S<:Real}(mat::AMat{T}, corrmat::AMat{S} = cor(mat);
|
||||||
colors = :redsblues,
|
colors = :redsblues,
|
||||||
labels = nothing, kw...)
|
labels = nothing, kw...)
|
||||||
m = size(mat,2)
|
m = size(mat,2)
|
||||||
|
|
||||||
# might be a mistake?
|
# might be a mistake?
|
||||||
@assert m <= 10
|
@assert m <= 20
|
||||||
@assert size(corrmat) == (m,m)
|
@assert size(corrmat) == (m,m)
|
||||||
|
|
||||||
# create a subplot grid, and a gradient from -1 to 1
|
# create a subplot grid, and a gradient from -1 to 1
|
||||||
p = subplot(rand(0,m^2); n=m^2, kw...)
|
p = subplot(rand(0,m^2); n=m^2, leg=false, kw...)
|
||||||
cgrad = ColorGradient(colors, [-1,1])
|
cgrad = ColorGradient(colors, [-1,1])
|
||||||
|
|
||||||
# make all the plots
|
# make all the plots
|
||||||
|
|||||||
@ -1,17 +1,14 @@
|
|||||||
|
|
||||||
function subplotlayout(sz::@compat(Tuple{Int,Int}))
|
function subplotlayout(sz::@compat(Tuple{Int,Int}))
|
||||||
# create a GridLayout
|
|
||||||
GridLayout(sz...)
|
GridLayout(sz...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function subplotlayout(rowcounts::AVec{Int})
|
function subplotlayout(rowcounts::AVec{Int})
|
||||||
# create a FlexLayout
|
|
||||||
FlexLayout(sum(rowcounts), rowcounts)
|
FlexLayout(sum(rowcounts), rowcounts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function subplotlayout(numplts::Int, nr::Int, nc::Int)
|
function subplotlayout(numplts::Int, nr::Int, nc::Int)
|
||||||
|
|
||||||
|
|
||||||
# figure out how many rows/columns we need
|
# figure out how many rows/columns we need
|
||||||
if nr == -1
|
if nr == -1
|
||||||
if nc == -1
|
if nc == -1
|
||||||
@ -41,35 +38,6 @@ function subplotlayout(numplts::Int, nr::Int, nc::Int)
|
|||||||
FlexLayout(numplts, rowcounts)
|
FlexLayout(numplts, rowcounts)
|
||||||
end
|
end
|
||||||
|
|
||||||
# # create a layout directly
|
|
||||||
# SubplotLayout(rowcounts::AbstractVector{Int}) = SubplotLayout(sum(rowcounts), rowcounts)
|
|
||||||
|
|
||||||
# # create a layout given counts... nr/nc == -1 implies we figure out a good number automatically
|
|
||||||
# function SubplotLayout(numplts::Int, nr::Int, nc::Int)
|
|
||||||
|
|
||||||
# # figure out how many rows/columns we need
|
|
||||||
# if nr == -1
|
|
||||||
# if nc == -1
|
|
||||||
# nr = round(Int, sqrt(numplts))
|
|
||||||
# nc = ceil(Int, numplts / nr)
|
|
||||||
# else
|
|
||||||
# nr = ceil(Int, numplts / nc)
|
|
||||||
# end
|
|
||||||
# else
|
|
||||||
# nc = ceil(Int, numplts / nr)
|
|
||||||
# end
|
|
||||||
|
|
||||||
# # create the rowcounts vector
|
|
||||||
# i = 0
|
|
||||||
# rowcounts = Int[]
|
|
||||||
# for r in 1:nr
|
|
||||||
# cnt = min(nc, numplts - i)
|
|
||||||
# push!(rowcounts, cnt)
|
|
||||||
# i += cnt
|
|
||||||
# end
|
|
||||||
|
|
||||||
# SubplotLayout(numplts, rowcounts)
|
|
||||||
# end
|
|
||||||
|
|
||||||
|
|
||||||
Base.length(layout::FlexLayout) = layout.numplts
|
Base.length(layout::FlexLayout) = layout.numplts
|
||||||
@ -253,11 +221,6 @@ function subplot!(subplt::Subplot, args...; kw...)
|
|||||||
delete!(d, s)
|
delete!(d, s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# haskey(d, :linkx) && (subplt.linkx = d[:linkx]; delete!(d, :linkx))
|
|
||||||
# haskey(d, :linky) && (subplt.linky = d[:linky])
|
|
||||||
# if haskey(d, :linkfunc)
|
|
||||||
# subplt.linkfunc = d[:linkfunc]
|
|
||||||
# end
|
|
||||||
|
|
||||||
# create the underlying object (each backend will do this differently)
|
# create the underlying object (each backend will do this differently)
|
||||||
# note: we call it once before doing the individual plots, and once after
|
# note: we call it once before doing the individual plots, and once after
|
||||||
@ -272,10 +235,13 @@ function subplot!(subplt::Subplot, args...; kw...)
|
|||||||
# TODO: something useful with meta info?
|
# TODO: something useful with meta info?
|
||||||
|
|
||||||
for (i,di) in enumerate(kwList)
|
for (i,di) in enumerate(kwList)
|
||||||
|
|
||||||
subplt.n += 1
|
subplt.n += 1
|
||||||
plt = getplot(subplt) # get the Plot object where this series will be drawn
|
plt = getplot(subplt) # get the Plot object where this series will be drawn
|
||||||
di[:show] = false
|
di[:show] = false
|
||||||
|
haskey(d, :dataframe) && delete!(d, :dataframe)
|
||||||
dumpdict(di, "subplot! kwList $i")
|
dumpdict(di, "subplot! kwList $i")
|
||||||
|
|
||||||
plot!(plt; di...)
|
plot!(plt; di...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -122,8 +122,8 @@ function expandLimits!(lims, x)
|
|||||||
e1, e2 = extrema(x)
|
e1, e2 = extrema(x)
|
||||||
lims[1] = min(lims[1], e1)
|
lims[1] = min(lims[1], e1)
|
||||||
lims[2] = max(lims[2], e2)
|
lims[2] = max(lims[2], e2)
|
||||||
catch err
|
# catch err
|
||||||
warn(err)
|
# warn(err)
|
||||||
end
|
end
|
||||||
nothing
|
nothing
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user