domitry/nyaplot

Ability to show normal distribution line in histograms

Opened this issue · 4 comments

v0dro commented

It would be great if an option for histograms would enable users to plot a normal distribution curve when creating a histogram.

Something like the graph in this example: http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Visualization/Creating%20a%20Histogram.ipynb

Maybe what you need will be achieved by adding short lines to Ruby code, but I don't know a good api. Could you show me some fake code?

v0dro commented
plot = Nyaplot::Plot.new :histogram, # other arguments for making histogram
plot.configure do |p|
  p.line_normal_distribution = true
end

Maybe use Diagram instead of Plot, I'm not completely sure.

Can you specify the mean and variance of normal distribution with this API?
Or is it useful even you can only add a line of N(0, 1)?

v0dro commented

I'm assuming that the data used for creating the plot was made using a Normal distribution Random Number Generator (something like rnorm(mean, std). The line will only serve as a guide.

Yes plotting the line yourself can be a good option but this just makes it MUCH more intuitive and avoids the hassle of generating the data yourself.