-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Feature request: stacked area plot #1423
Comments
I'm pretty sure we have that functionality? Let me check. |
Could you look at this and say if that comes close or you'd need something else? |
Yes, that recipe is working for me. I modified it slightly for my use by switching sx and sy. I also see that PyPlot as a stackplot function but it is not exported by Plots. |
Plots doesn't really use PyPlot to draw what you see, recipes define the different plots you can chose from. |
That example results in an error on Julia 0.6.2 (
A suggestion. Stacked area plots have lots of uses outside the world of finance. How about just calling this recipe |
All of those are good ideas 👍 |
In case a simple stackedarea recipe is still needed. This works fine for me:
|
Thanks for posting that @mariok90 — I needed this and your recipe was greatly appreciated. I updated it for 1.0 and added the ability to pass the x-axis as the first argument to @userplot AreaPlot
@recipe function f(a::AreaPlot)
data = cumsum(a.args[end], dims=2)
x = length(a.args) == 1 ? (1:size(data, 1)) : a.args[1]
seriestype := :line
fillrange := 0
@series begin
x, data[:,1]
end
for i in 2:size(data, 2)
@series begin
fillrange := data[:,i-1]
x, data[:,i]
end
end
end Use like |
or areaplot(-5:5, rand(11, 3)) (or areaplot!(-5:5, rand(11, 3)) to add to an existing plot) |
I tried using the julia> using Plots
julia> x = [1 2 3]
1×3 Array{Int64,2}:
1 2 3
julia> y = rand(3,3)
3×3 Array{Float64,2}:
0.403945 0.734758 0.702108
0.480646 0.192144 0.323393
0.0790197 0.450067 0.812049
julia> portfoliocomposition(x,y)
ERROR: UndefKeywordError: keyword argument dims not assigned Which seems very weird... I would also like to second the suggestion that
Is this recipe available as part of Plots? Do I need to add a package to use it or currently do I just need to define the above recipe myself? |
We should just add the AreaPlot as a recipe to Plots. |
Would it be possible to create a convenient way to create stacked area plots? E.g. http://johnmyleswhite.github.io/Vega.jl/areaplot.html
A normalize option would be very useful to create a 100% stacked area plot.
The text was updated successfully, but these errors were encountered: