I have two data sets and i want to plot them in a histogram. I want to have the same bin size for both of them, is there an easy way to do it? (Julia)
I have two data sets and i want to plot them in a histogram. I want to have the same bin size for both of them, is there an easy way to do it? (Julia)
Define the bins yourself because otherwise whichever plotting package your are using likely has a heuristic to define the bins for you (so 2 different datasets might result in 2 different sets of bins).
For example, with Plots.jl:
using Plots
bins = -3:0.2:3
datasets = (randn(1000), rand(1000))
plot((histogram(d; bins) for d in datasets)...) # note the specified bins
will give a histogram for each dataset with the same bins: