changed convertToAnyVector AMat so that all matrices use the version previously for numbers; violin cleanup
This commit is contained in:
parent
730025e144
commit
73ffcb9bc1
@ -752,21 +752,9 @@ end
|
||||
|
||||
@recipe function f(::Type{Val{:violin}}, x, y, z; trim=true)
|
||||
delete!(d, :trim)
|
||||
|
||||
# create a list of shapes, where each shape is a single boxplot
|
||||
# shapes = Shape[]
|
||||
xsegs, ysegs = Segments(), Segments()
|
||||
# groupby = extractGroupArgs(x)
|
||||
glabels = sort(collect(unique(x)))
|
||||
|
||||
# for (i, glabel) in enumerate(groupby.groupLabels)
|
||||
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)
|
||||
isempty(widths) && continue
|
||||
|
||||
@ -777,14 +765,12 @@ end
|
||||
xcenter = discrete_value!(d[:subplot][:xaxis], glabel)[1]
|
||||
xcoords = vcat(widths, -reverse(widths)) + xcenter
|
||||
ycoords = vcat(centers, reverse(centers))
|
||||
# push!(shapes, Shape(xcoords, ycoords))
|
||||
|
||||
push!(xsegs, xcoords)
|
||||
push!(ysegs, ycoords)
|
||||
end
|
||||
|
||||
seriestype := :shape
|
||||
# d[:x], d[:y] = shape_coords(shapes)
|
||||
x := xsegs.pts
|
||||
y := ysegs.pts
|
||||
()
|
||||
|
||||
@ -21,8 +21,7 @@ convertToAnyVector{T<:Number}(v::AVec{T}, d::KW) = Any[v], nothing
|
||||
# string vector
|
||||
convertToAnyVector{T<:@compat(AbstractString)}(v::AVec{T}, d::KW) = Any[v], nothing
|
||||
|
||||
# numeric matrix
|
||||
function convertToAnyVector{T<:Number}(v::AMat{T}, d::KW)
|
||||
function convertToAnyVector(v::AMat, d::KW)
|
||||
if all3D(d)
|
||||
Any[Surface(v)]
|
||||
else
|
||||
@ -30,14 +29,6 @@ function convertToAnyVector{T<:Number}(v::AMat{T}, d::KW)
|
||||
end, nothing
|
||||
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
|
||||
convertToAnyVector(f::Function, d::KW) = Any[f], nothing
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user