Adding support for arrays in violin-plot
This commit is contained in:
parent
a5ceea153d
commit
f7c06da93e
@ -719,8 +719,21 @@ end
|
|||||||
|
|
||||||
# create a list of shapes, where each shape is a single boxplot
|
# create a list of shapes, where each shape is a single boxplot
|
||||||
shapes = Shape[]
|
shapes = Shape[]
|
||||||
groupby = extractGroupArgs(d[:x])
|
|
||||||
|
|
||||||
|
legend --> false
|
||||||
|
|
||||||
|
if length(d[:x])==1
|
||||||
|
widths, centers = violin_coords(d[:y], trim=trim)
|
||||||
|
# normalize
|
||||||
|
widths = _box_halfwidth * widths / maximum(widths)
|
||||||
|
|
||||||
|
# make the violin
|
||||||
|
xcenter = discrete_value!(d[:subplot][:xaxis], d[:x][1])[1]
|
||||||
|
xcoords = vcat(widths, -reverse(widths)) + xcenter
|
||||||
|
ycoords = vcat(centers, reverse(centers))
|
||||||
|
push!(shapes, Shape(xcoords, ycoords))
|
||||||
|
else
|
||||||
|
groupby = extractGroupArgs(d[:x])
|
||||||
for (i, glabel) in enumerate(groupby.groupLabels)
|
for (i, glabel) in enumerate(groupby.groupLabels)
|
||||||
|
|
||||||
# get the edges and widths
|
# get the edges and widths
|
||||||
@ -736,6 +749,8 @@ end
|
|||||||
ycoords = vcat(centers, reverse(centers))
|
ycoords = vcat(centers, reverse(centers))
|
||||||
push!(shapes, Shape(xcoords, ycoords))
|
push!(shapes, Shape(xcoords, ycoords))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# d[:plotarg_overrides] = KW(:xticks => (1:length(shapes), groupby.groupLabels))
|
# d[:plotarg_overrides] = KW(:xticks => (1:length(shapes), groupby.groupLabels))
|
||||||
seriestype := :shape
|
seriestype := :shape
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user