Skip to content

Commit

Permalink
add plt.show()
Browse files Browse the repository at this point in the history
  • Loading branch information
murphyk committed Mar 4, 2021
1 parent 160122b commit bd21b99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Binary file modified scripts/__pycache__/pyprobml_utils.cpython-38.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion scripts/ab_test_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def eprofit_total(N, n1, n2, s, mu, sigma):
plt.axhline(eprofit_opt)
plt.text(nopt, eprofit_opt, 'n*={:0.1f}'.format(nopt))
savefig('ab_profit.png')
plt.show()

plt.figure();
plt.plot(ns, error_rate)
Expand All @@ -83,4 +84,5 @@ def eprofit_total(N, n1, n2, s, mu, sigma):
plt.axvline(nopt)
plt.axhline(error_rate_opt)
plt.text(nopt, error_rate_opt, 'n*={:0.1f}'.format(nopt))
savefig('ab_error.png')
savefig('ab_error.png')
plt.show()
10 changes: 5 additions & 5 deletions scripts/gauss_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np
import matplotlib.pyplot as plt
import os
figdir = "../figures"
def save_fig(fname): plt.savefig(os.path.join(figdir, fname))


import pyprobml_utils as pml

from scipy.stats import norm

Expand All @@ -14,11 +14,11 @@ def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
fig, ax = plt.subplots()
ax.plot(X, rv.pdf(X))
plt.title("Gaussian pdf")
save_fig("gaussian1d.pdf")
pml.save_fig("gaussian1d.pdf")
plt.show()

fig, ax = plt.subplots()
ax.plot(X, rv.cdf(X))
plt.title("Gaussian cdf")
save_fig("gaussianCdf.pdf")
pml.save_fig("gaussianCdf.pdf")
plt.show()

0 comments on commit bd21b99

Please sign in to comment.