nyaplot icon indicating copy to clipboard operation
nyaplot copied to clipboard

Ability to show normal distribution line in histograms

Open v0dro opened this issue 10 years ago • 4 comments

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

v0dro avatar Jun 04 '15 19:06 v0dro

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?

domitry avatar Jun 22 '15 17:06 domitry


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.

v0dro avatar Jun 22 '15 17:06 v0dro

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)?

domitry avatar Jun 25 '15 03:06 domitry

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.

v0dro avatar Jun 25 '15 17:06 v0dro