changed convertToAnyVector AMat so that all matrices use the version previously for numbers; violin cleanup

This commit is contained in:
Thomas Breloff 2016-06-22 13:20:09 -04:00
parent 730025e144
commit 73ffcb9bc1
2 changed files with 1 additions and 24 deletions

View File

@ -752,21 +752,9 @@ end
@recipe function f(::Type{Val{:violin}}, x, y, z; trim=true) @recipe function f(::Type{Val{:violin}}, x, y, z; trim=true)
delete!(d, :trim) delete!(d, :trim)
# create a list of shapes, where each shape is a single boxplot
# shapes = Shape[]
xsegs, ysegs = Segments(), Segments() xsegs, ysegs = Segments(), Segments()
# groupby = extractGroupArgs(x)
glabels = sort(collect(unique(x))) glabels = sort(collect(unique(x)))
# for (i, glabel) in enumerate(groupby.groupLabels)
for glabel in glabels for glabel in glabels
# get the edges and widths
# gids = groupby.groupIds[i]
# y = eltype(y)[yi for (i,yi) in e]
# y = y[filter(i -> cycle(x,i) == glabel, 1:length(y))]
# y = d[:y][groupby.groupIds[i]]
widths, centers = violin_coords(y[filter(i -> cycle(x,i) == glabel, 1:length(y))], trim=trim) widths, centers = violin_coords(y[filter(i -> cycle(x,i) == glabel, 1:length(y))], trim=trim)
isempty(widths) && continue isempty(widths) && continue
@ -777,14 +765,12 @@ end
xcenter = discrete_value!(d[:subplot][:xaxis], glabel)[1] xcenter = discrete_value!(d[:subplot][:xaxis], glabel)[1]
xcoords = vcat(widths, -reverse(widths)) + xcenter xcoords = vcat(widths, -reverse(widths)) + xcenter
ycoords = vcat(centers, reverse(centers)) ycoords = vcat(centers, reverse(centers))
# push!(shapes, Shape(xcoords, ycoords))
push!(xsegs, xcoords) push!(xsegs, xcoords)
push!(ysegs, ycoords) push!(ysegs, ycoords)
end end
seriestype := :shape seriestype := :shape
# d[:x], d[:y] = shape_coords(shapes)
x := xsegs.pts x := xsegs.pts
y := ysegs.pts y := ysegs.pts
() ()

View File

@ -21,8 +21,7 @@ convertToAnyVector{T<:Number}(v::AVec{T}, d::KW) = Any[v], nothing
# string vector # string vector
convertToAnyVector{T<:@compat(AbstractString)}(v::AVec{T}, d::KW) = Any[v], nothing convertToAnyVector{T<:@compat(AbstractString)}(v::AVec{T}, d::KW) = Any[v], nothing
# numeric matrix function convertToAnyVector(v::AMat, d::KW)
function convertToAnyVector{T<:Number}(v::AMat{T}, d::KW)
if all3D(d) if all3D(d)
Any[Surface(v)] Any[Surface(v)]
else else
@ -30,14 +29,6 @@ function convertToAnyVector{T<:Number}(v::AMat{T}, d::KW)
end, nothing end, nothing
end end
# other matrix... vector of columns
function convertToAnyVector(m::AMat, d::KW)
Any[begin
v = vec(m[:,i])
length(v) == 1 ? v[1] : v
end for i=1:size(m,2)], nothing
end
# function # function
convertToAnyVector(f::Function, d::KW) = Any[f], nothing convertToAnyVector(f::Function, d::KW) = Any[f], nothing