import matplotlib.pyplot as plt bright = {'0':6, '1':2, '2':5, '3':5, '4':4, '5':5, '6':6, '7':3, '8':7, '9':6} def time(minc): hours = str(minc/60) minutes = str(minc%60) if len(minutes) < 2: minutes = '0' + minutes if len(hours) < 2: hours = '0' + hours text = hours+minutes return sum((bright[val] for val in text)) x = range(1440) y = [time(val) for val in x] xy = zip(x,y) xy.sort(key = lambda x: x[1]) print xy[0], xy[-1] plt.scatter(x,y, s = 50, alpha = .1) plt.show()