
Вот мой код
# Understanding this code is not essential for the tutorial
import cartopy.crs as ccrs
import cartopy.feature as cfeature
# Latitude and longitude for the edges of the map
lat1, lat2, lon1, lon2= 32, 42.5, -125, -114
# Create figures
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(1, 1, 1, projection = ccrs.Mercator())
# Get latitude and longitude for each data point
x, y = (train['Longitude'].to_numpy(), train['Latitude'].to_numpy())
# Scatter plot as heat map
ax.scatter(x,y,s=(train['Population'].to_numpy()/30.0), c=train['MedianHouseValue'].to_numpy(),
edgecolors='none', cmap=plt.get_cmap('rainbow'), alpha=0.5, transform=ccrs.PlateCarree())
# Add state borders and coast line
ax.add_feature(cfeature.STATES.with_scale('50m'))
ax.add_feature(cfeature.COASTLINE.with_scale('50m'))
ax.set_extent([-125, -113.5, 32, 42.5], crs=ccrs.PlateCarree())
ax.set_title('Median house values in California (training data)', fontsize=17, y=1.01, fontweight='bold')
plt.show()
Подробнее здесь: https://stackoverflow.com/questions/741 ... ception-in