"""
Exercise 7.7.9

Discovering Computer Science, Third Edition
Jessen Havill
"""

import matplotlib.pyplot as pyplot
from matplotlib import cm

def plot_salinity_temp(data_dict):
    # set up the color map
    number_days = len(data_dict)
    color_map = cm.get_cmap('plasma', number_days)
    normalizer = pyplot.Normalize(0, number_days)
    pyplot.colorbar(cm.ScalarMappable(norm = normalizer, cmap = color_map), 
                    label = 'Profile Number', ax = pyplot.gca())
    count = 0
    for date in data_dict:
        readings = data_dict[date]
        readings.sort()
        
        # get the lists of salinity and temperature 
        # measurements for this date
        
        pyplot.plot(salinity_list, temp_list, 
                    linewidth = 0.25, 
                    color = color_map(count / number_days))
        count = count + 1
        
    pyplot.xlabel('Practical Salinity')
    pyplot.ylabel('Temperature (degrees Celsius)')
    pyplot.show()
