Description
Documentation Link
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imread.html
Problem
Following the deprecation message in matplotlib.pyplot.imread
(when used with a URL) and trying to replace the code as suggested with PIL.Image.open(urllib.request.urlopen(url))
, the resulting object is a PIL image object and not a numpy array as it used to be. As we are typically suggesting imread
to create a numpy array from an image file (or URL) in some of our teaching materials, this is a bit confusing.
This is probably not a problem for matplotlib itself, as it can perfectly deal with the PIL object in eg. imshow
, therefore I don’t know if it needs to be changed (it could be out of scope for the matplotlib documentation to clarify this).
Suggested improvement
Additionally present code that shows how to transform the PIL image object into an array.
Matplotlib Version
3.4.3
Matplotlib documentation version
3.4.3