Mercurial > public > think_complexity
comparison ch4ex4.py @ 28:15ff31ecec7a
Use a linear scale on the y-axis.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 06 Jan 2013 14:57:01 -0600 |
parents | f6073c187926 |
children |
comparison
equal
deleted
inserted
replaced
27:78116556b491 | 28:15ff31ecec7a |
---|---|
42 l_vals.insert(0, 1.0) | 42 l_vals.insert(0, 1.0) |
43 | 43 |
44 # plot graph | 44 # plot graph |
45 pyplot.clf() | 45 pyplot.clf() |
46 pyplot.xscale('log') | 46 pyplot.xscale('log') |
47 pyplot.yscale('log') | 47 pyplot.yscale('linear') |
48 pyplot.title('') | 48 pyplot.title('') |
49 pyplot.xlabel('p') | 49 pyplot.xlabel('p') |
50 pyplot.ylabel('C(p)/C(0)') | 50 pyplot.ylabel('C(p)/C(0)') |
51 pyplot.plot(p_vals, c_vals, label='C(p)/C(0)', color='green', linewidth=3) | 51 pyplot.plot(p_vals, c_vals, label='C(p)/C(0)', color='green', linewidth=3) |
52 pyplot.plot(p_vals, l_vals, label='L(p)/L(0)', color='blue', linewidth=3) | 52 pyplot.plot(p_vals, l_vals, label='L(p)/L(0)', color='blue', linewidth=3) |
53 pyplot.legend(loc=4) | 53 pyplot.legend(loc='lower left') |
54 pyplot.show() | 54 pyplot.show() |