fixed boxplot grouping; cleaned up GroupBy recipe; added arg_descs
This commit is contained in:
parent
42d57fb8c2
commit
cf4fcf3351
@ -27,21 +27,21 @@ const _arg_desc = KW(
|
|||||||
:x => "Various. Input data. First Dimension",
|
:x => "Various. Input data. First Dimension",
|
||||||
:y => "Various. Input data. Second Dimension",
|
:y => "Various. Input data. Second Dimension",
|
||||||
:z => "Various. Input data. Third Dimension. May be wrapped by a `Surface` for surface and heatmap types.",
|
:z => "Various. Input data. Third Dimension. May be wrapped by a `Surface` for surface and heatmap types.",
|
||||||
:marker_z => "",
|
:marker_z => "AbstractVector. z-values for each series data point, which correspond to the color to be used from a markercolor gradient.",
|
||||||
:levels => "",
|
:levels => "Integer, NTuple{2,Integer}. Number of levels (or x-levels/y-levels) for a contour type.",
|
||||||
:orientation => "",
|
:orientation => "Symbol. Horizontal or vertical orientation for bar types. Values `:h`, `:hor`, `:horizontal` correspond to horizontal (sideways, anchored to y-axis), and `:v`, `:vert`, and `:vertical` correspond to vertical (the default).",
|
||||||
:bar_position => "",
|
:bar_position => "Symbol. Choose from `:overlay` (default), `:stack`. (warning: May not be implemented fully)",
|
||||||
:bar_width => "",
|
:bar_width => "nothing or Number. Width of bars in data coordinates. When nothing, chooses based on x (or y when `orientation = :h`).",
|
||||||
:bar_edges => "",
|
:bar_edges => "Bool. Align bars to edges (true), or centers (the default)?",
|
||||||
:xerror => "",
|
:xerror => "AbstractVector or 2-Tuple of Vectors. x (horizontal) error relative to x-value. If 2-tuple of vectors, the first vector corresponds to the left error (and the second to the right)",
|
||||||
:yerror => "",
|
:yerror => "AbstractVector or 2-Tuple of Vectors. y (vertical) error relative to y-value. If 2-tuple of vectors, the first vector corresponds to the bottom error (and the second to the top)",
|
||||||
:ribbon => "",
|
:ribbon => "Number or AbstractVector. Creates a fillrange around the data points.",
|
||||||
:quiver => "",
|
:quiver => "AbstractVector or 2-Tuple of vectors. The directional vectors U,V which specify velocity/gradient vectors for a quiver plot.",
|
||||||
:arrow => "",
|
:arrow => "nothing (no arrows), Bool (if true, default arrows), Arrow object, or arg(s) that could be style or head length/widths. Defines arrowheads that should be displayed at the end of path line segments (just before a NaN and the last non-NaN point). Used in quiverplot, streamplot, or similar.",
|
||||||
:normalize => "",
|
:normalize => "Bool. Should normalize histogram types? Trying for area == 1.",
|
||||||
:weights => "",
|
:weights => "AbstractVector. Used in histogram types for weighted counts.",
|
||||||
:contours => "",
|
:contours => "Bool. Add contours to the side-grids of 3D plots? Used in surface/wireframe.",
|
||||||
:match_dimensions => "",
|
:match_dimensions => "Bool. For heatmap types... should the first dimension of a matrix (rows) correspond to the first dimension of the plot (x-axis)? The default is false, which matches the behavior of Matplotlib, Plotly, and others. Note: when passing a function for z, the function should still map `(x,y) -> z`.",
|
||||||
:subplot => "",
|
:subplot => "",
|
||||||
:series_annotations => "",
|
:series_annotations => "",
|
||||||
:primary => "",
|
:primary => "",
|
||||||
|
|||||||
@ -274,6 +274,8 @@ function _plot!(plt::Plot, d::KW, args...)
|
|||||||
# we make a copy of the KW and apply an errorbar recipe
|
# we make a copy of the KW and apply an errorbar recipe
|
||||||
errkw = copy(kw)
|
errkw = copy(kw)
|
||||||
errkw[:seriestype] = esym
|
errkw[:seriestype] = esym
|
||||||
|
errkw[:label] = ""
|
||||||
|
errkw[:primary] = false
|
||||||
push!(kw_list, errkw)
|
push!(kw_list, errkw)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -478,7 +478,7 @@ notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# make the shape
|
# make the shape
|
||||||
center = i - 0.5
|
center = discrete_value!(d[:subplot][:xaxis], glabel)[1]
|
||||||
l, m, r = center - _box_halfwidth, center, center + _box_halfwidth
|
l, m, r = center - _box_halfwidth, center, center + _box_halfwidth
|
||||||
# internal nodes for notches
|
# internal nodes for notches
|
||||||
L, R = center - 0.5 * _box_halfwidth, center + 0.5 * _box_halfwidth
|
L, R = center - 0.5 * _box_halfwidth, center + 0.5 * _box_halfwidth
|
||||||
@ -522,8 +522,8 @@ notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N)
|
|||||||
# d[:plotarg_overrides] = KW(:xticks => (1:length(shapes), groupby.groupLabels))
|
# d[:plotarg_overrides] = KW(:xticks => (1:length(shapes), groupby.groupLabels))
|
||||||
|
|
||||||
seriestype := :shape
|
seriestype := :shape
|
||||||
n = length(groupby.groupLabels)
|
# n = length(groupby.groupLabels)
|
||||||
xticks --> (linspace(0.5,n-0.5,n), groupby.groupLabels)
|
# xticks --> (linspace(0.5,n-0.5,n), groupby.groupLabels)
|
||||||
|
|
||||||
# clean d
|
# clean d
|
||||||
pop!(d, :notch)
|
pop!(d, :notch)
|
||||||
|
|||||||
@ -366,14 +366,27 @@ end
|
|||||||
# # handle grouping
|
# # handle grouping
|
||||||
# # --------------------------------------------------------------------
|
# # --------------------------------------------------------------------
|
||||||
|
|
||||||
|
# @recipe function f(groupby::GroupBy, args...)
|
||||||
|
# for (i,glab) in enumerate(groupby.groupLabels)
|
||||||
|
# # create a new series, with the label of the group, and an idxfilter (to be applied in slice_and_dice)
|
||||||
|
# # TODO: use @series instead
|
||||||
|
# @show i, glab, groupby.groupIds[i]
|
||||||
|
# di = copy(d)
|
||||||
|
# get!(di, :label, string(glab))
|
||||||
|
# get!(di, :idxfilter, groupby.groupIds[i])
|
||||||
|
# push!(series_list, RecipeData(di, args))
|
||||||
|
# end
|
||||||
|
# nothing
|
||||||
|
# end
|
||||||
|
|
||||||
|
# split the group into 1 series per group, and set the label and idxfilter for each
|
||||||
@recipe function f(groupby::GroupBy, args...)
|
@recipe function f(groupby::GroupBy, args...)
|
||||||
for (i,glab) in enumerate(groupby.groupLabels)
|
for (i,glab) in enumerate(groupby.groupLabels)
|
||||||
# create a new series, with the label of the group, and an idxfilter (to be applied in slice_and_dice)
|
@series begin
|
||||||
# TODO: use @series instead
|
label --> string(glab)
|
||||||
di = copy(d)
|
idxfilter --> groupby.groupIds[i]
|
||||||
get!(di, :label, string(glab))
|
args
|
||||||
get!(di, :idxfilter, groupby.groupIds[i])
|
end
|
||||||
push!(series_list, RecipeData(di, args))
|
|
||||||
end
|
end
|
||||||
nothing
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user