Sha256: 7b085cf7b41832bea628c5ade97c3ec313559f3e71d905e5c24c8b845c2b3934
Contents?: true
Size: 542 Bytes
Versions: 2
Compression:
Stored size: 542 Bytes
Contents
require 'pycall/import' include PyCall::Import pyimport 'numpy', as: 'np' pyimport 'matplotlib.mlab', as: 'mlab' pyimport 'matplotlib.pyplot', as: 'plt' np.random.seed.(0) mu = 100 sigma = 15 x = mu + sigma * np.random.randn.(437) num_bins = 50 fig, ax = plt.subplots.() n, bins, patches = ax.hist.(x, num_bins, normed: 1) y = mlab.normpdf.(bins, mu, sigma) ax.plot.(bins, y, '--') ax.set_xlabel.('Smarts') ax.set_ylabel.('Probability density') ax.set_title.('Histogram of IQ: $\mu=100$, $\sigma=15$') fig.tight_layout.() plt.show.()
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pycall-0.1.0.alpha.20170224b | examples/hist.rb |
pycall-0.1.0.alpha.20170224 | examples/hist.rb |