%matplotlib inline
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

m = Basemap(projection='mill',
           llcrnrlat=-90,
           llcrnrlon=-180,
           urcrnrlat=90,
           urcrnrlon=180,
           resolution='l')

m.drawcoastlines()
m.drawcountries(linewidth=2)
m.drawstates(color='b')
m.bluemarble()

"""
Explanation: In this notebook I'll go through Sentdex's tutorial 28 to learn how to plot points on a map.
End of explanation
"""


m = Basemap(projection='mill',
           llcrnrlat=24.9493,
           llcrnrlon=-125.0011,
           urcrnrlat=49.5904,
           urcrnrlon=-66.9326,
           resolution='l')
m.drawcoastlines()
m.drawcountries(linewidth=1.5)
m.drawstates(color='black')

"""
Explanation: How we have a map of the world, with bright blue state borders. This isn't exactly what we want.
A quick search for 'US bounding box' gives us US coordinates.
Black state boundaries look a lot less jarring, as do thinner country borders.
The color still isn't what we want, but we can fix that later.
End of explanation
"""


water_color = '#C1D2D2'
continent_color = '#EBECEC'

m = Basemap(projection='mill',
           llcrnrlat=24.5,
           llcrnrlon=-125.0011,
           urcrnrlat=49.5904,
           urcrnrlon=-66.9326,
           resolution='l')
m.drawcoastlines()
m.drawcountries(linewidth=1.5)
m.drawstates(color='black')
m.fillcontinents(color=continent_color, lake_color=water_color)
m.drawmapboundary(fill_color=water_color)

NYClat, NYClon = 40.7127, -74.0059
xpt, ypt = m(NYClon, NYClat)
m.plot(xpt, ypt, 'c*', markersize=15, alpha=0.75)

LAlat, LAlon = 34.05, -118.25
xpt, ypt = m(LAlon, LAlat)
m.plot(xpt, ypt, 'g^', markersize=15, alpha=0.75)

"""
Explanation: Next, we'll plot some points on the map. Los Angeles and New York.
End of explanation
"""


water_color = '#C1D2D2'
continent_color = '#EBECEC'
plt.figure(figsize=(12,6))


m = Basemap(projection='mill',
           llcrnrlat=24.5,
           llcrnrlon=-125.0011,
           urcrnrlat=49.5904,
           urcrnrlon=-66.9326,
           resolution='l')
m.drawcoastlines()
m.drawcountries(linewidth=1)
m.drawstates(color='black')
m.fillcontinents(color=continent_color, lake_color=water_color)
m.drawmapboundary(fill_color=water_color)

NYClat, NYClon = 40.7127, -74.0059
# xpt, ypt = m(NYClon, NYClat)
# m.plot(xpt, ypt, 'c*', markersize=15, alpha=0.75)

LAlat, LAlon = 34.05, -118.25
# xpt, ypt = m(LAlon, LAlat)
# m.plot(xpt, ypt, 'g^', markersize=15, alpha=0.75)
xpt, ypt = m([NYClon, LAlon], [NYClat, LAlat])
m.plot(xpt, ypt, 'g^', markersize=15, alpha=0.75)
plt.savefig('us_test.png', bbox_inches='tight', pad_inches=0.0)

"""
Explanation: Now we've plotted two points on the map. The 'c*' stands for cyan star.
We've also changed the colors of the map to match the Tableau normal map color scheme.
The next things I want to do:
- Plot multiple points of various sizes at once.
- Add a title and a caption.
- Save to file and make it an appropriate size.
End of explanation
"""


