The following code generates a map of the US with a contour line for every state. The problem is that the image looks like it was generated with 1990s technology. How can I significantly improve the quality of the figure, i.e. increase the resolution of the background?
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.dpi'] = 400
fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1], projection=ccrs.LambertConformal())
ax.set_extent([-125, -66.5, 20, 50], ccrs.Geodetic())
ax.stock_img()
shapename = 'admin_1_states_provinces_lakes_shp'
states_shp = shpreader.natural_earth(resolution='110m', category='cultural',
name=shapename)
ax.outline_patch.set_visible(False) # don't draw the map border
ax.set_title('My map of the lower 48')
# example state coloring
colors = {
'Minnesota': [0, 1, 0],
'Texas': "#FF0000",
'Montana': "blue",
}
default_color = [0.9375, 0.9375, 0.859375]
for state in shpreader.Reader(states_shp).records():
facecolor = colors.get(state.attributes['name'], default_color)
ax.add_geometries([state.geometry], ccrs.PlateCarree(),
facecolor=facecolor, edgecolor='black', alpha=0.5,linewidth=0.1)
# example data
df = pd.DataFrame(columns=['city', 'lat', 'lon'], data=[
('Hoboken', 40.745255, -74.034775),
('Port Hueneme', 34.155834, -119.202789),
('Auburn', 42.933334, -76.566666),
('Jamestown', 42.095554, -79.238609),
('Fulton', 38.846668, -91.948059),
('Bedford', 41.392502, -81.534447)
])
ax.plot(df['lon'], df['lat'], transform=ccrs.PlateCarree(),
ms=8, ls='', marker='*')
#plt.show()
plt.savefig("usa.png")
plt.close()




