Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple histograms in Julia using Plots.jl

Tags:

julia

plots.jl

I am working with a large number of observations and to really get to know it I want to do histograms using Plots.jl My question is how I can do multiple histograms in one plot as this would be really handy. I have tried multiple things already, but I am a bit confused with the different plotting sources in julia (plots.jl, pyplot, gadfly,...).

I don't know if it would help for me to post some of my code, as this is a more general question. But I am happy to post it, if needed.

like image 591
DoubleBass Avatar asked Mar 08 '26 22:03

DoubleBass


1 Answers

There is an example that does just this:

using Plots
pyplot()

n = 100
x1, x2 = rand(n), 3rand(n)

# see issue #186... this is the standard histogram call
# our goal is to use the same edges for both series
histogram(Any[x1, x2], line=(3,0.2,:green), fillcolor=[:red :black], fillalpha=0.2)

I looked for "histograms" in the Plots.jl repo, found this related issue and followed the links to the example.

like image 163
Felipe Lema Avatar answered Mar 14 '26 14:03

Felipe Lema



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!