I have the following pandas dataframe (df) which looks like this with column headers and data values, 3 points each:
temperature: array([-101.6015625, -100.9296875, -85.4296875])
latitude: array([32.54681317, 32.81152175, 30.30341752])
longitude: array([-101.6015625, -100.9296875, -85.4296875])
Using these following imports:
import matplotlib.pyplot as plt
import pandas
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import cartopy.crs as ccrs
When I run this code snippet:
d = {'temperature': [-101.6015625, -100.9296875, -85.4296875], 'latitude': [32.54681317, 32.81152175, 30.30341752], 'longitude': [-101.6015625, -100.9296875, -85.4296875]}
df = pd.DataFrame(data=d)
df = df.reset_index()
geom = [Point(x,y) for x, y in zip(df['longitude'], df['latitude'])]
gdf = gpd.GeoDataFrame(df, geometry=geom)
gdf.crs = {'init': 'epsg:4326'}
fig1 = plt.figure()
ax11 = fig1.add_subplot(121, projection=ccrs.PlateCarree())
ax11.coastlines()
ax21 = fig1.add_subplot(121)
ax21.set_frame_on(False)
ax21.xaxis.set_visible(False)
ax21.yaxis.set_visible(False)
gdf.plot(ax=ax21)
plt.tight_layout()
plt.margins(y=10)
ax11.set_xlim(ax21.get_xlim())
ax11.set_ylim(ax21.get_ylim())
plt.show()
However, when I run the following to centre the map over the North Pole,
d = {'temperature': [-101.6015625, -100.9296875, -85.4296875], 'latitude': [32.54681317, 32.81152175, 30.30341752], 'longitude': [-101.6015625, -100.9296875, -85.4296875]}
df = pd.DataFrame(data=d)
df = df.reset_index()
geom = [Point(x,y) for x, y in zip(df['longitude'], df['latitude'])]
gdf = gpd.GeoDataFrame(df, geometry=geom)
fig = plt.figure()
ax1 = fig.add_subplot(121, projection=ccrs.AzimuthalEquidistant(central_latitude=90, central_longitude=0))
ax1.coastlines()
ax2 = fig.add_subplot(121)
ax2.set_frame_on(False)
ax2.xaxis.set_visible(False)
ax2.yaxis.set_visible(False)
gdf.to_crs("+proj=aeqd +lat_0=90 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs").plot(ax=ax2)
plt.tight_layout()
plt.margins(y=10)
The coordinates are in the wrong position.
I have followed this kaggle tutorial tried using this North Pole Azimuthal Equidistant transform on the GeoDataFrame but I think I have not implemented it correctly.
The output I'm after I would like to look like this:



