-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat: Multi-histogram plot #5340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
I also want to add an optional dodge positioning for the histogram, but this would require conditionally setting either map!(plot, :points, [:flatbins, :stack]) do points
flatbins = collect(Iterators.flatten(points))
stack = [i for (i, bin) in enumerate(points) for _ in 1:length(bin)]
return (flatbins, stack)
end |
|
The map!(plot, [:values, :edges, :normalization, :scale_to, :weights], :points) do values, edges, normalization, scale_to, weights
points = []
for (i, dataset) in enumerate(values)
if weights === automatic
wgts = automatic
else
wgts = weights[i]
end
centers, weights = _hist_center_weights(dataset, edges, normalization, scale_to, wgts)
push!(points, Point2.(centers, weights))
end
return points
endGiving the error |
|
I'd say this should be a change to |
so with an extra |
No, barplot for example has a |
|
I can also refactor this if you're not already working on it |
|
I think this should be done now. You can now do either: # established syntax:
hist(rand(200), stack = vcat(fill(1, 100), fill(2, 100))
# vector of vectors syntax:
hist([rand(100), rand(100)], stack = [1, 2])where stack can be replaced with dodge. |
Thanks! Sorry I didn't have time to work on this. |
Description
This PR adds a multi-histogram plotting function
multihist!like seaborn's stacked histogram. Below is an example of stacked vs dodged histograms.Vide https://discourse.julialang.org/t/stacked-histogram/133248
Type of change
Delete options that do not apply:
Checklist