Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 small issues I noticed (inverted lines of code in book + pcolor graph doesn't show) #61

Closed
nickk opened this issue Dec 25, 2018 · 4 comments

Comments

@nickk
Copy link

nickk commented Dec 25, 2018

On page 42, the following 2 lines of code should be inverted (i.e. config before plot):
spectrum.plot_power(linewidth=1, alpha=0.5)
thinkplot.config(xscale='log', yscale='log')

In thinkplot.py, I had to add the following 2 lines at the end of def Pcolor(...:
if pcolor:
plt.pcolormesh(X, Y, Z, **options)
plt.show() #ADDED THIS OTHERWISE NOTHING SHOWS UP
if contour:
cs = plt.contour(X, Y, Z, **options)
plt.clabel(cs, inline=1, fontsize=10)
plt.show() # DITTO

Excellent book though, I'm learning a lot!

@AllenDowney
Copy link
Owner

AllenDowney commented Dec 25, 2018 via email

@nickk
Copy link
Author

nickk commented Dec 26, 2018

EDIT: small typo on page 94: "Convolution it is such a common operation that..."
EDIT 2: duplicate "a wave" on p 97, section 8.4

Hi, this may be frivolous, but if I follow the code in the book, I never get nice (read: containing multiple lines) graphs like you have pictured in the book. E.g. the following code makes the 2nd graph (ys2) pop up only after the first is closed. Plus the labels don't seem to show up.

thinkplot.config(xlabel='Xs', ylabel='Ys')
thinkplot.plot(ts, ys, label='double')
thinkplot.plot(ts, ys2, label='squared')

In order to make a nice graph, I resorted to the following:

fig, ax = pyplot.subplots()
line1 = ax.plot(ts, ys, label='double')
line2 = ax.plot(ts, ys2, label='squared')
ax.legend()
pyplot.xlabel('Xs')
pyplot.ylabel('Ys')
pyplot.show()

It's possible I'm missing something obvious since I'm only a "casual" programmer, but I thought I might as well flag this.

@AllenDowney
Copy link
Owner

AllenDowney commented Dec 26, 2018 via email

@AllenDowney
Copy link
Owner

I can't find this:

EDIT 2: duplicate "a wave" on p 97, section 8.4
Maybe it already got fixed. Thanks, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants