rethinkpriorities / squigglepy

Squiggle programming language for intuitive probabilistic estimation features in Python
MIT License
65 stars 8 forks source link

BaseDistribution: Add naive .plot() #12

Closed hibukki closed 1 year ago

hibukki commented 1 year ago

Nothing fancy, just replace

samples = total_tuners_in_2022 @ 1000
plt.hist(samples, bins=200)
plt.show()

with

total_tuners_in_2022.plot()

I think more can be done here, like using Seaborn, but I tried keeping this PR simple and uncontroversial.

The old functionality is still supported, so this shouldn't break anything.

Regarding this: num_samples=None, bins=None, I decided to leave flexibility for the implementation to decide on the num_samples if the user defines the bins, and vice versa, but this isn't a strong opinion.

Fixes #4

peterhurford commented 1 year ago

Thank you!