miscplot_2.py 505 B

12345678910111213141516
  1. def dogplot(*_, **__):
  2. """Who's a good boy?"""
  3. try:
  4. from urllib.request import urlopen
  5. except ImportError:
  6. from urllib2 import urlopen
  7. from io import BytesIO
  8. url = "https://github.com/mwaskom/seaborn-data/raw/master/png/img{}.png"
  9. pic = np.random.randint(2, 7)
  10. data = BytesIO(urlopen(url.format(pic)).read())
  11. img = plt.imread(data)
  12. f, ax = plt.subplots(figsize=(5, 5), dpi=100)
  13. f.subplots_adjust(0, 0, 1, 1)
  14. ax.imshow(img)
  15. ax.set_axis_off()