Conversation
| # Here, we used Pillow to open an image (with `PIL.Image.open`), and | ||
| # immediately converted the `PIL.Image.Image` object into a 8-bit | ||
| # (``dtype=uint8``) numpy array. |
There was a problem hiding this comment.
| # Here, we used Pillow to open an image (with `PIL.Image.open`), and | |
| # immediately converted the `PIL.Image.Image` object into a 8-bit | |
| # (``dtype=uint8``) numpy array. | |
| # We use Pillow to open an image (with `PIL.Image.open`), and | |
| # immediately convert the `PIL.Image.Image` object into an 8-bit | |
| # (``dtype=uint8``) numpy array. |
And this should maybe be before the code instead of and here we go
| @@ -205,20 +199,19 @@ | |||
| # | |||
| # You can specify the clim in the call to ``plot``. | |||
There was a problem hiding this comment.
| # You can specify the clim in the call to ``plot``. | |
| # You can specify the clim (colormap limits) in the call to ``plot``. |
I think clim is colormap limits?
| ax = fig.add_subplot(1, 2, 1) | ||
| plt.subplot(1, 2, 1) | ||
| imgplot = plt.imshow(lum_img) | ||
| ax.set_title('Before') | ||
| plt.colorbar(ticks=[0.1, 0.3, 0.5, 0.7], orientation='horizontal') | ||
| ax = fig.add_subplot(1, 2, 2) | ||
| plt.title('Before') | ||
| plt.colorbar(orientation='horizontal') | ||
| plt.subplot(1, 2, 2) | ||
| imgplot = plt.imshow(lum_img) | ||
| imgplot.set_clim(0.0, 0.7) | ||
| ax.set_title('After') | ||
| plt.colorbar(ticks=[0.1, 0.3, 0.5, 0.7], orientation='horizontal') | ||
| imgplot.set_clim(0, 175) | ||
| plt.title('After') | ||
| plt.colorbar(orientation='horizontal') |
There was a problem hiding this comment.
I think this should stay OO since that's what we usually recommend, but with an fig, (ax1m ax2) = plt.subplots( ncols=2)
all the other examples are pyplot 'cause it's only a line of code and I think that's a fairly clear distinction?
There was a problem hiding this comment.
I just got rid of the subplots, keeping only the second plot seems good enough.
|
|
||
| ############################################################################### | ||
| # Here we have the default interpolation, bilinear, since we did not | ||
| # Here we have the default interpolation ("nearest"), since we did not |
There was a problem hiding this comment.
| # Here we have the default interpolation ("nearest"), since we did not | |
| # Here we use the default interpolation ("nearest"), since we did not |
| @@ -205,20 +199,19 @@ | |||
| # | |||
| # You can specify the clim in the call to ``plot``. | |||
There was a problem hiding this comment.
And its imshownotplot`, we are talking about.
Then maybe:
| # You can specify the clim in the call to ``plot``. | |
| # You can specify the colormap limits using ``imshow(..., clim=...)``. |
Sorry, to comment on code you're not responsible for, but this is too glaringly wrong.
| from PIL import Image | ||
|
|
||
| img = Image.open('../../doc/_static/stinkbug.png') | ||
| img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place |
There was a problem hiding this comment.
| img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place | |
| img.thumbnail((64, 64)) # resizes image in-place |
May just as well put that here instead of #23881 (which can be closed then).
|
Thanks, handled all comments (got rid of the subplots, as noted re: @story645's suggestion). |
- Use Pillow to load the image rather than the discouraged plt.imread. - Remove discussion about rescaling to 0-1 as dropping the use of plt.imread also gets rid of that (not so nice) behavior. Also drop the lengthy discussion about uint8 and float32, which seems out of place here (if anything it should be in the Pillow docs). Make corresponding fixes to code to use 0-255 instead of 0-1. - Fix subplot management to go full pyplot (the local switch to OO-style is a bit weird). - Fix interpolation discussion as the default is now "nearest" (actually it's now "antialiased", but let's sweep that under the rug for this tutorial for now).
- Use Pillow to load the image rather than the discouraged plt.imread. - Remove discussion about rescaling to 0-1 as dropping the use of plt.imread also gets rid of that (not so nice) behavior. Also drop the lengthy discussion about uint8 and float32, which seems out of place here (if anything it should be in the Pillow docs). Make corresponding fixes to code to use 0-255 instead of 0-1. - Fix subplot management to go full pyplot (the local switch to OO-style is a bit weird). - Fix interpolation discussion as the default is now "nearest" (actually it's now "antialiased", but let's sweep that under the rug for this tutorial for now).
- Use Pillow to load the image rather than the discouraged plt.imread. - Remove discussion about rescaling to 0-1 as dropping the use of plt.imread also gets rid of that (not so nice) behavior. Also drop the lengthy discussion about uint8 and float32, which seems out of place here (if anything it should be in the Pillow docs). Make corresponding fixes to code to use 0-255 instead of 0-1. - Fix subplot management to go full pyplot (the local switch to OO-style is a bit weird). - Fix interpolation discussion as the default is now "nearest" (actually it's now "antialiased", but let's sweep that under the rug for this tutorial for now).
- Use Pillow to load the image rather than the discouraged plt.imread. - Remove discussion about rescaling to 0-1 as dropping the use of plt.imread also gets rid of that (not so nice) behavior. Also drop the lengthy discussion about uint8 and float32, which seems out of place here (if anything it should be in the Pillow docs). Make corresponding fixes to code to use 0-255 instead of 0-1. - Fix subplot management to go full pyplot (the local switch to OO-style is a bit weird). - Fix interpolation discussion as the default is now "nearest" (actually it's now "antialiased", but let's sweep that under the rug for this tutorial for now).
See #22790. Probably the tutorial could be further improved, but let's consider this a small step in that direction.
PR Summary
PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).