-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Additional cleanups #7547
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
Additional cleanups #7547
Changes from all commits
de302f5
46b9d47
1504540
3d00576
69622dd
f1b25e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,10 @@ def func3(x, y): | |
# for the images their apparent extent could be different due to | ||
# interpolation edge effects | ||
|
||
|
||
xmin, xmax, ymin, ymax = np.amin(x), np.amax(x), np.amin(y), np.amax(y) | ||
extent = xmin, xmax, ymin, ymax | ||
extent = np.min(x), np.max(x), np.min(y), np.max(y) | ||
fig = plt.figure(frameon=False) | ||
|
||
Z1 = np.array(([0, 1]*4 + [1, 0]*4)*4) | ||
Z1.shape = (8, 8) # chessboard | ||
Z1 = np.add.outer(range(8), range(8)) % 2 # chessboard | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes the first argument a column array and the second a row array, broadcasts them and applies the ufunc. |
||
im1 = plt.imshow(Z1, cmap=plt.cm.gray, interpolation='nearest', | ||
extent=extent) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,7 @@ | |
|
||
# Data are 256x256 16 bit integers | ||
dfile = cbook.get_sample_data('s1045.ima.gz') | ||
im = np.fromstring(dfile.read(), np.uint16).astype(float) | ||
im.shape = (256, 256) | ||
im = np.fromstring(dfile.read(), np.uint16).reshape((256, 256)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No Also, can write There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can imshow an integer array just as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the one below this still need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed below too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, fromfile doesn't work with gzip.open'ed files (it seems to try to construct an array from the compressed representation). Reverting to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, unfortunate. Based on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left a comment on numpy/numpy#7713; we'll see where it goes... |
||
dfile.close() | ||
|
||
ax.imshow(im, cmap=cm.gray) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print
inserts a space, soprint('symbol.ljust(maxfunc), 'description'.ljust(maxdoc))
would have worked, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but that looks a bit "unintended" to me.