from matplotlib.pyplot import plot, show, legend, xlabel, ylabel, title, grid, savefig


def fahr_to_cel(temp):
    return (temp - 32) * 5 / 9


if __name__ == "__main__":
    nyc_temp_2000 = [fahr_to_cel(t) for t in [31.3, 37.3, 47.2, 51.0, 63.5, 71.3, 72.3, 72.7, 66.0, 57.0, 45.3, 31.1]]
    nyc_temp_2006 = [fahr_to_cel(t) for t in [40.9, 35.7, 43.1, 55.7, 63.1, 71.0, 77.9, 75.8, 66.6, 56.2, 51.9, 43.6]]
    nyc_temp_2012 = [fahr_to_cel(t) for t in [37.3, 40.9, 50.9, 54.8, 65.1, 71.0, 78.8, 76.7, 68.8, 58.0, 43.9, 41.5]]

    months = range(1, 13)

    plot(months, nyc_temp_2000, marker='x', linestyle='dashdot')
    plot(months, nyc_temp_2006, marker='x', linestyle='dotted')
    plot(months, nyc_temp_2012, marker='x', linestyle='None')

    title("Temperature in New York City")
    xlabel("Months")
    ylabel("Temperature [C]")
    legend([2000, 2006, 2012])

    grid()
    # savefig("wykres1.png")
    show()
