#!/usr/bin/env python # coding: utf-8 # We made a ton of really nice figures today, and I'd like to let you take home a personalized version as my way of saying thanks for attending. Please run the code cells below to generate your personalized ordering of the Circos plots we made. # In[1]: import hashlib import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: def make_image(name): integer = int(hashlib.sha1(bytes(name, 'utf-8')).hexdigest(), 16) digits = [int(i) for i in list(str(integer))] # Set the order of images. order = [] for d in digits: if d not in order: order.append(d) images = {0: 'seventh.png', 1: 'sociopatterns.png', 2: 'physicians.png', 3: 'divvy.png', 4: 'crime-person.png', 5: 'crime-crime.png'} imgs_read = [] for i in order: if i in images.keys(): imgs_read.append(mpimg.imread('images/{0}'.format(images[i]))) # Save the images to disk plt.imshow(np.hstack(imgs_read)) plt.axis('off') plt.savefig('images/custom-logo.png', dpi=900, bbox_inches='tight') plt.savefig('images/custom-logo-small.png', dpi=75, bbox_inches='tight') print('Thank you for attending, {0}!'.format(name)) print('Your hash-ordered image can be found in at "images/custom-logo.png".'.format(name)) # In[4]: # Change accordingly! :) make_image('Eric Ma') # In[ ]: # In[ ]: # In[ ]: